One of the first things in PHP that really stumped me was the difference between code that created output and code that didn’t. I knew, vaguely, that things that had an echo statement in PHP meant something important, but that was about it.
What I now get, is that echo statements are essentially output generators: they “leak out” of other PHP code. They create meaningful, visible output, most other PHP code doesn’t. Most other PHP code will transform data, but it won’t show it to users. But what we’re focusing on here is that you can actually capture, store, and use echoed output in a way that initially confused me and then blew my mind a bit.
So let’s get to it. Basically, we’ll:
Understand the difference between output and data-processing in a bit more detail