Following a long tradition of introductory programming and scripting tutorials, our first example will print "Hello World" in the browser window.

Code:
<HTML>
<HEAD>
<TITLE> Hello World in PHP </TITLE>
</HEAD>
<BODY>
<?
// Hello world in PHP
 print("Hello World");
?>
</BODY>
</HTML>
The PHP statement:

Code:
<? print("Hello World"); ?>
displays the message "Hello World" in the browser window. As was mentioned earlier, PHP statements are embedded into HTML documents and they appear between <? and ?> symbols.

The PHP print function displays the value or string within parentheses in the browser window.

Several important things to note about PHP scripts:

PHP is case sensitive, print is different from PRINT
PHP statements appear between <? ?>
PHP statements end with a semi-colon
You can include comments in your PHP code by beginning the line or lines with // characters
Your PHP files should have a .php extension rather than a .html extension. If scripts have a .html extension the server will not know that they are PHP files and will not parse and execute the PHP commands.