Most of us are familiar with how a web application works. We know that when we enter an URL in our browser, it’ll contact a web server who’ll return some HTML. The browser will then make follow-up requests and then render the web page. (This is a simplification! But that’s the main idea.)
But what’s happening on the web server returning HTML? How is the web server getting the HTML that it returns to our browser? And, to be even more specific, how does this happen in PHP?
This isn’t something that most of us know how to answer. We know (or at least should know!) how to build a PHP website. But what happens between our PHP code and the browser is a bit of a mystery.
There’s a good chance that you’re thinking, “Well, my site loads. Why should I think twice about this?” And that’s true! But the truth is that knowing how a PHP application works can be useful.
It can affect how you design your PHP application. But it’s also important if you’re looking to improve its performance. For example, it’s hard to understand PHP application caching if you don’t understand how a PHP application works.