- First character must be start with $
- Second character should be start with either alphabet or underscore like ($_ , $a etc)
- Space are not allowed.If you try to use space in variables name then PHP will throw parse error like below:
Parse error: syntax error, unexpected 'b' (T_STRING)
- Special characters are not allowed except _ .So if you try to put special characters in php variables name then it always throw Parse error.
- You can use numbers after second character.Example ( $_123,$a123,@a_b123) these are the correct variable name.
Examples :
Correct : $_a, $a_fsdf , $_123, $a1nb etc
Wrong : account, $1asd ,$aaa$df, $test abc etc