3v4l.org

run code in 300+ PHP versions simultaneously
<?php // int isn't a reserved word, right? // So this should work fine! const int = 7; // Let's try using it! echo int; echo (int) 8.7 /* Wait, what? A parse error? Why, you might ask? (int) is a special case in the lexer. Turns out that casts are lexed specially. Why? Probably to stop the type names being reserved words. That worked out spectacularly, didn't it. This has been around since at least PHP 3. */
Output for 5.4.0 - 5.4.30
Parse error: syntax error, unexpected end of file, expecting ',' or ';' in /in/6SYER on line 17
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected $end, expecting ',' or ';' in /in/6SYER on line 17
Process exited with code 255.

preferences:
183.59 ms | 1395 KiB | 67 Q