A PHP variable is a symbol used to store a value. For example, add the following assignment statement to your hello.php.
$sentence = "The moose is brooding";
Now use this variable by adding the following line to your hello.php, after the above:
print("The sentence is: $sentence <BR>");Your web page should show "The sentence is: The moose is brooding".
Variables can also be set equal to numbers. Try adding the following to hello.php, and see what happens:
$x = 3;
print($x);
print("<BR>");
$x = 3.14159265;
print($x);
print("<BR>");
$x = "My pen is leaking.";
print($x);
print("<BR>");
Some things to note:
Try the following PHP code and see what happens.
$a = 5;Answer the following questions.
$b = 3;
print($a * $b);
print("<BR>");
print($a / $b);
print("<BR>");
print($a % $b);
print("<BR>");