PHP Variables
The concept of a variable is used to store information that can be used later on. PHP variables are very easy to setup and define; here is the syntax:
$nameOfVariable = Value;
where Value can be any string.
Examples:
$var = 'Hello World';
$data = '12345';
$myString = 'xyz';
To print a variable out to the webpage, just use the 'echo' statement:
echo $var;
According to www.tizag.com, here are some important tips on variable naming conventions:
There are a few rules that you need to follow when choosing a name for your PHP variables.
PHP variables must start with a letter or underscore "_".
PHP variables may only be comprised of alpha-numeric characters and underscores. a-z, A-Z, 0-9, or _ .
Variables with more than one word should be separated with underscores. $my_variable
Variables with more than one word can also be distinguished with capitalization. $myVariable
Labels: PHP 101



