34,333
edits
Changes
→How Does PHP Work?
<?php
echo '<h1>This line of HTML was generated by a PHP script embedded into an HTML document</h1>';
?>
</body>
</html>
</pre>
The above example looks very miuch like standard HTML until the part surrounded by ''<?php'' and ''?>''. These are markers that designate where the PHP scriptlet begins and ends. When the web server finds this it sends it to the PHP module. the PHP module interprets it, converts it to HTML and sends it back to the web server. The web server then sends the following modified web page to the browser, devoid of any PHP scripthing and containing only original HTML and the output from the PHP script:
<pre>
<html>
<head>
<title>A PHP Example</title>
</head>
<body>
<h1>This line of HTML was generated by a PHP script embedded into an HTML document</h1>
</body>
</html>
</pre>
<h1>This line of HTML was generated by a PHP script embedded into an HTML document</h1>';
?>