• A variable must start with a dollar ($) sign.
• It can only contain alpha-numeric character and underscore (A-z, 0-9, _).
• A variable name must start with a letter or underscore (_) character.
• A PHP variable name cannot contain spaces.
• One thing to be kept in mind that the variable name cannot start with a number or special symbols.
• PHP variables are case-sensitive, so $name and $NAME both are treated as different variable.
Incorrect syntax:
name = "No name";
$1x = 20;
$)name = "No name";
$na me = "Hola";
&na-me = "Hello";
Correct syntax:
$name = "No name";
$x1 = 20;
$_name = "Hello";