Variables are “containers” for storing information:
Example
<?php
|
|
$x=5; |
|
$y=6; |
|
$z=$x+$y; |
|
echo $z; |
|
?>
|
Much Like Algebra
x=5
y=6
z=x+y
In algebra we use letters (like x) to hold values (like 5).
From the expression z=x+y above, we can calculate the value of z to be 11.
In PHP these letters are called variables.