Variables are used to store data at runtime, like string of text, numbers, etc. Variable values can change over the course of a script. Here're some important things to know about variables:
In PHP, 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.
After declaring a variable it can be reused throughout the code.
The assignment operator (=) used to assign value to a variable.
Rules for Php Variables
All variables in PHP Script start with a '$'' sign, followed by the name of the
A variable name should start with the underscore character _ or a letter.
A variable name cannot start with a number.
A variable name in PHP can only contain alpha-numeric characters and
underscores (A-z, 0-9, and _).
A variable name cannot contain spaces
php Based position we hava three types
The variable which are outside the fnction or block that type varibes we are called as
if want use inside the function should be declare by using global keyword
Local Varibels we are inside the function
we can use only inside the function
Php LocalVarible Example:
static are declared with static keyword