A variable is a special container that you can define, which will then hold a value, such as a number, string, object, array, or Boolean.
Variables allow us to create templates for operation, such as adding two numbers, without worrying about the specific values the variables represent.Values will be given to the variables when the script is run, possibky through user input, through a database query, or form the result of another action in the script.
All variables in PHP start with a $ sign symbol.
Variable names can include letters, numbers, and the underscore character (_), but they cannot include spaces. Here are the rules:
Variable names are case-sensitive.
Here are acceptable variable names:
$a;
$_hello;
$a_very_long_variable;
$Myname123; $MyName123;
Here are unacceptable variable names:
$12345; (begins with a number)
$my-name; (unacceptable character: -)
$hello!; (unacceptable character: !)
$You+me; (unacceptable character: +)
$me@abc.com; (unacceptable characters: @ and .)
A semicolon (;) is used to end a PHP statement.