Home | Store | osCommerce Tutorials

What is PHP

You may consider PHP as part of the HTML document.

PHP files should be saved with the .php file extension (e.g. myfile.php, test.php)

A block of PHP code starts with "<?php" and ends with "?>" and can be placed anywhere in the HTML document.

A block of PHP code should looks like:


//PHP commands here


A typical example of PHP codes placed in HTML document should look like:

<title>PHP Tutorial</title>

<h1>Typical PHP Example</h1>


//PHP commands here
echo "Hello World";



The output of the above typical PHP example should look like:

Typical PHP Example

Hello World


In PHP codes, all comments are preceded by //. Comments will be ignored by computer. Comments simply allow people to understand your codes as well provide easy maintenance purpose for programers.

Remember that every PHP command ends with a semicolon (;).