3v4l.org

run code in 300+ PHP versions simultaneously
<?php class x { function z() { static x = 2; return x++; } } $x = new x; var_dump($x->z()); var_dump($x->z()); var_dump($x->z());
Output for 5.4.0 - 5.4.12
Parse error: syntax error, unexpected 'x' (T_STRING), expecting :: (T_PAAMAYIM_NEKUDOTAYIM) in /in/UNSqo on line 6
Process exited with code 255.
Output for 5.3.0 - 5.3.22
Parse error: syntax error, unexpected T_STRING, expecting T_PAAMAYIM_NEKUDOTAYIM in /in/UNSqo on line 6
Process exited with code 255.

preferences:
182.93 ms | 1386 KiB | 43 Q