3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bar { $derp = 'fucking dumb'; } class Foo { public function __sleep() { $name = 'this'; $$name = new Bar; } } $d = new Foo; $d->bar(); print_r(unserialize(serialize($d)));
Output for 5.4.18 - 5.4.19
Parse error: syntax error, unexpected '$derp' (T_VARIABLE), expecting function (T_FUNCTION) in /in/1giZ1 on line 3
Process exited with code 255.
Output for 5.4.0 - 5.4.17
Parse error: syntax error, unexpected '$derp' (T_VARIABLE), expecting function (T_FUNCTION) in /in/FnEJv on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /in/FnEJv on line 3
Process exited with code 255.

preferences:
167.29 ms | 1395 KiB | 55 Q