Wednesday, December 26, 2012
Variables in PHP
- All variables in PHP start with a $ sign symbol.
- PHP is a Loosely Typed Language, i.e. a variable does not need to be declared before adding a value to it. PHP automatically converts the variable to the correct data type, depending on its value.
- A variable name must start with a letter or an underscore "_".
- A variable name can only contain alpha-numeric characters and underscores (a-z, A-Z, 0-9, and _ ).
- A variable name should not contain spaces.
The below code shows how to print a variable.