I realize that PHP uses an interpreter rather then a compiler so that it makes just one pass. But does it process the HTML before the PHP code? It doesn't seem to do just a top down kind of processing by processing all the code in the order it was written.
PHP performs multiple passes through your code before execution. It will, for example, catch any parse errors in your code before the code is ever executed. Although I don't know for sure one way or the other, it's not outside the realm of possibility that the PHP interpreter actually compiles your script to memory then executes the compiled version.
But considering that[ul][li]PHP isn't just for HTML output but rather a general-purpose programming language[/li][li]that you can write a PHP script in either context-switch style (combining multiple bare HTML output blocks with multiple PHP code sections inside <?php...?> tags) or pure PHP style (using a single <?php...?> block that spans the whole script and using print or echo statements to produce HTML output)[/li][li]that PHP doesn't parse HTML blocks at all but simply streams them to the web server[/li][/ul] PHP simply can't be parsing HTML first.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.