PHP works with the webserver without a server, it doesn’t take any requests and it doesn’t respond to 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 webserver through a browser with a 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.
When a browser calls a PHP program, it first searches through the entire code line by line to locate all the PHP sections.
PHP has special tags to locate PHP code on page <?PHP and ?>, After finding the section of the PHP server will parse the code and send it to web browsers as an 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 " <b>THE MOST POPULAR SCRIPTING LANGUAGE IS PHP</b>"; echo " <u>THANKS FOR LOVING PHP _ :D </u>"; ?>
This above PHP can be embedded with HTML code. Lets explain this code when user requests for .php file through browser that will search for <?php start section and ?> end section of PHP tags.
When those tags are found the server will parse the .php file into the .html file and send it back to the browser. echo “Hello World !”; instruct script to display placed string inside echo scope, it will show you on browser HELLO WORLD !.