4 ms·
That's the grammar for PHP integer literals[1]: decimal : [1-9][0-9]* | 0 hexadecimal : 0[xX][0-9a-fA-F]+ octal
by bnr 15y ago
That's the grammar for PHP integer literals[1]:
decimal : [1-9][0-9]*
| 0
hexadecimal : 0[xX][0-9a-fA-F]+
octal : 0[0-7]+
integer : [+-]?decimal
| [+-]?hexadecimal
| [+-]?octal
"08" and "09" do not match any of these.
php -r "var_dump(08);"
Yields "int(0)", while the case should rather be treated as a syntax error, if you ask me.
The bottom line probably is that your literals just shouldn't have leading zeroes…
[1] http://www.php.net/manual/en/language.types.integer.php http://www.php.net/manual/en/language.types.integer.php