Escaping From HTML
Here is an example of a PHP script. Notice that it is embedded inside ordinary HTML. The <?php and ?> mark the beginning and end of the PHP part of the file.
We tend to use PHP to produce the HTML that we want on the page. In this case, the PHP is writing some text in a heading tag to the page.
echo "<h1>Hello World</h1>";
Copy the code and save the file as test.php. The .php extension tells the server to use PHP to process the file.
You will need to place the file inside the htdocs folder of your server installation.
To run the page, launch the server and go to http://127.0.0.1/test.php. View the source of the web page you see. You should notice that the PHP has been replaced with just the HTML. That is to be expected, the echo statement is an output statement. Our script was just echoing some HTML. The semi-colon is used at the end of each line in PHP as it is in most C family languages. PHP is CasE SeNsiTiVe.
When there is a terminating character in a language, it often means that statements can be written over more than one line. The echo statement is a good example of that. The text inside the quotation marks can be several lines - as long as the quotation marks are closed and the line ends with a semi-colon, all is good.