If you have never use any programming Algebra then variables concept might a new concept for you. Detailed explanation of variables in this tutorial.
The PHP variables means the storing the values like text string “a4avariables”, or integers values “1,2,3”. PHP Variables named “Containers” that store a value. A variable can reuse again and again in your code.
PHP defined with the following form.
$variable_name = Value;
If you forget that dollar sign at the beginning, it will not work. This is a common mistake for new PHP programmers!
Rules of Variables
- Variable names are case-sensitive(y and Y are two different variables).
- Don’t forget that dollar sign at the beginning.
- PHP variables must start with a alpha-numeric letter or underscore (A-Z,0-9,_).
- Variables name should not contain spaces.
- Variable name more than one word should be separated with underscores($aone_php).
- More then one word also distinguished with capitalization like ($aonePhp).
$myVariable = "PHP is Very Easy For all!";
We have use a variable name $myVariable and use one string parameter value(PHP is Very Easy For all!).
Then we call the variable name from echo command.
PHP is Very Easy For all!
Another Example of php variables