3v4l.org

run code in 300+ PHP versions simultaneously
<?php spl_autoload_register(function () { var_dump(func_get_args()); }); try { new Foo(); } catch(Throwable $t) { var_dump($t); } if (true) { class Foo {} var_dump(new Foo()); }
Output for 8.0.0 - 8.0.10, 8.1rc1
array(1) { [0]=> string(3) "Foo" } object(Error)#2 (7) { ["message":protected]=> string(21) "Class "Foo" not found" ["string":"Error":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/iSXM2" ["line":protected]=> int(8) ["trace":"Error":private]=> array(0) { } ["previous":"Error":private]=> NULL } object(Foo)#3 (0) { }
Output for 7.3.0 - 7.3.30, 7.4.0 - 7.4.23
array(1) { [0]=> string(3) "Foo" } object(Error)#2 (7) { ["message":protected]=> string(21) "Class 'Foo' not found" ["string":"Error":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/iSXM2" ["line":protected]=> int(8) ["trace":"Error":private]=> array(0) { } ["previous":"Error":private]=> NULL } object(Foo)#3 (0) { }

preferences:
360.16 ms | 461 KiB | 5 Q