3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { function __destruct() { echo "a dtor\n"; } } class B { function __destruct() { echo "b dtor\n"; } function doSomething() { echo "b still alive\n"; } $a = new A; $b = new B;
Output for 5.4.0 - 5.4.8
Parse error: syntax error, unexpected '$a' (T_VARIABLE), expecting function (T_FUNCTION) in /in/cgoRi on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.18
Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /in/cgoRi on line 5
Process exited with code 255.

preferences:
182.27 ms | 1395 KiB | 35 Q