PHP - Learn How PHP Works

The PHP works with the web server without server it doesn't take any request and it doesn't respond any things to the browser, PHP is the software that delivers web pages to the world.

The PHP works with the web server without server it doesn't take any request and it doesn't respond any things to the browser, PHP is the software that delivers web pages to the world.

When you enter a URL (Uniform Resource Locator) into your web browser’s address bar, you’re sending a request to the web server through a browser with URL, asking it to send you an HTML file.

The web server responds by sending the requested file. Your browser reads the HTML file and displays the web page.

PHP - Learn How PHP Works

When a browser calls a PHP program, it first searches through the entire code line by line to locate all PHP section.

PHP have special tags to locate PHP code on page <?PHP and ?>, After finding the section of PHP server will parse the code and send it to web browsers as HTML file.  Let's take an example,

<?php
        echo "HELLO WORLD ! ";
        echo "<p>PHP SCRIPT IS RUNNING SUCCESSFULLY</p>";
        echo "<i>DO ECHO TO GET STRING OUTPUT</i>";
        echo "&nbsp;<b>THE MOST POPULAR SCRIPTING LANGUAGE IS PHP</b>";
        echo "&nbsp;<u>THANKS FOR LOVING PHP _ :D </u>";
?>

This above PHP can be embedded with HTML code.

Lets explain this code when user request for .php file through browser that will search for <?php start section and ?> end section of PHP tags.

When those tags are found server will parse .php file into .html file and send it back to browser. echo "Hello World !"; instruct script to display placed string inside echo scope, it will show you on browser HELLO WORLD !. 

You May Also Like...