3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Autoloader1 { public static function autoload ($class) { var_dump("Loading {$class} from " . __CLASS__); spl_autoload_register(["Autoloader2", "autoload"]); } } class Autoloader2 { public static function autoload ($class) { var_dump("Loading {$class} from " . __CLASS__);exit; } } spl_autoload_register(["Autoloader1", "autoload"]); $r = new Foo();
Output for 5.6.0 - 5.6.30, 7.0.3 - 7.3.1
string(28) "Loading Foo from Autoloader1" string(28) "Loading Foo from Autoloader2"
Output for 7.0.0 - 7.0.2
string(28) "Loading Foo from Autoloader1" Fatal error: Uncaught Error: Class 'Foo' not found in /in/7gp1b:21 Stack trace: #0 {main} thrown in /in/7gp1b on line 21
Process exited with code 255.
Output for hhvm-3.12.14 - 3.17.3
string(28) "Loading Foo from Autoloader1" Fatal error: Uncaught Error: Class undefined: Foo in /in/7gp1b:21 Stack trace: #0 {main}
Process exited with code 255.