3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public function __construct () { $this->call = new class(){}; } public function __destruct() { echo 'Destruct: ' . get_class($this) . PHP_EOL; } } class B { public function __destruct() { echo 'Destruct: ' . get_class($this) . PHP_EOL; } } function test() { new A; new B; } test(); echo "Exit\n";
based on HUMA1
Output for 7.0.0 - 7.2.0
Destruct: A Destruct: B Exit
Output for 5.4.11 - 5.6.28
Parse error: syntax error, unexpected 'class' (T_CLASS) in /in/j1g3S on line 7
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_CLASS in /in/j1g3S on line 7
Process exited with code 255.