3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = new stdclass; $x->42 = 1337; $x = (array)$x; foreach ($x as $key => $value) { if (!array_key_exists($key, $x)) echo 'lolphp'; } ?>
Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.29, 5.6.7 - 5.6.13
Parse error: syntax error, unexpected '42' (T_LNUMBER), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /in/Xr0Tv on line 3
Process exited with code 255.

preferences:
182.65 ms | 1395 KiB | 63 Q