Home | Store | osCommerce Tutorials

PHP Variables

A variable is used to store values so that it can used in any time.

A variable inside a PHP block of codes should looks like:


$var = Value;


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

<title>PHP Tutorial</title>

<h1>PHP Variables Example</h1>


$shop = "osCommerce Online Shop";

echo 'The value of $shop variable is: ' . $shop;



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

PHP Variables Example

The value of $shop variable is: osCommerce Online Shop


  1. We used 'The value of $shop variable is: ', not "The value of $shop variable is: ". Because we want to print out the $shop wording.
  2. We used the "dot" to join 'The value of $shop variable is: ' and $shop. The 'dot' is called PHP Concatenation operator and will be disussed in next PHP tutorial.