How php is parsed

• So you have a file, and in that file you have some HTML and some PHP code. This is 
how it all works, assuming a PHP document with an extension of .php. 
• The web browser requests a document with a .php extension. 
• The web server says, "Hey! Someone wants a PHP file, which means this is a file 
that needs to be parsed," and sends the request on to the PHP parser. 
• The PHP parser finds the requested file and scans it for PHP code. 

• When the PHP parser finds PHP code, it executes that code and places the resulting 
output (if any) into the place in the file formerly occupied by the code. 
• This new output file is sent back to the web server. 
• The web server sends it along to the web browser. 

• The web browser displays the output. 

• Because the PHP code is parsed on the server, this method of code execution is 
called server-side code. When code is executed in a browser, such as JavaScript, it 
is called client-side code. 

• To combine PHP code with HTML, the PHP code must be set apart from the HTML. 
In the next section, you'll learn how this is done, using PHP start and end tags. 

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post