Contents / Previous / Next


Hello World

Write a file called hello_world.php and open it in your browser (Files including PHP code must end with extensions .php or .phtml to be recognized form the web server): <html> <body> <h3>This is the PHP script:</h3> <?php echo 'Hello World! <p>'; ?> This is again HTML ... </body> </html>

How does the HTTP-Server process HTML and PHP together?

The web server will read the HTML file from top to bottom, and when ever it comes across PHP script (identified by an opening <?php and a closing ?> it will send it off to the PHP engine to be interpreted and converted into HTML. The output of the PHP interpreter will be inserted into the HTML stream generated by the server from the HTML page.
It is this stream that will be sent to the client resulting in a display.