Basics of PHP - Part 2
Today we'll start by storing a variable. A variable is like an alias, a friendly name for a particular string you've predefined. Don't worry about new lines when writing your script, php ignores them.
<?php
$var1 = "hello world, ";
$var2 = "how are we today?";
?>
Let's take a look at the code line for line;
<?php - Open PHP tag
$var1 = "hello world, "; - Define $var1 and end with ';' to tell PHP we've finished with that line of code
$var2 = "how are we today?"; - Same
?> - Close PHP tag
Now that we have out variables defined, let's echo them out
<?php
echo $var1 . $var2;
?>
This would display "hello world, how are we today?" on our webpage. The full stop between the varialbes acts as an 'and'. We begin by using the echo function and ask it to echo out $var1 AND $var2.
Stay tuned
Ryan Partington


