Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Order of jprocessing

Status
Not open for further replies.

judi

Programmer
Jan 13, 2001
35
US
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.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top