Variable has the same definition in all the programming languages. Their implementation or declaration or syntax may be different but concept is same for all the languages.
A variable is used for storing value such as text strings, numbers or arrays.
You able to use variable over and over again in your PHP script after declaring it.
Given below example give you a quick look of correct way of declaring PHP variable :
$var_name = value;
Given below key naming conventions of PHP variable :
No need of declaring data type in PHP
A PHP variable doesn't need to be declare before before adding a value to it. PHP automatically converts the variable to the correct data type, depending on its value.
In the given below example, you will see that there is no need of mentioning data type before passing value to it.
<?php $variable_txt="Hello World!"; $variable_num=16; ?>
Recommend the tutorial