3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_exception_handler(function (Throwable $exception) { var_dump($exception->getTrace()); }); class Foo { private $foo; public function __toString() { return $this->foo; } } sprintf('%s', new Foo());
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.4, 8.3.6 - 8.3.7
array(2) { [0]=> array(4) { ["function"]=> string(10) "__toString" ["class"]=> string(3) "Foo" ["type"]=> string(2) "->" ["args"]=> array(0) { } } [1]=> array(4) { ["file"]=> string(9) "/in/lJ61X" ["line"]=> int(17) ["function"]=> string(7) "sprintf" ["args"]=> array(2) { [0]=> string(2) "%s" [1]=> object(Foo)#2 (1) { ["foo":"Foo":private]=> NULL } } } }
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 array(2) { [0]=> array(4) { ["function"]=> string(10) "__toString" ["class"]=> string(3) "Foo" ["type"]=> string(2) "->" ["args"]=> array(0) { } } [1]=> array(4) { ["file"]=> string(9) "/in/lJ61X" ["line"]=> int(17) ["function"]=> string(7) "sprintf" ["args"]=> array(2) { [0]=> string(2) "%s" [1]=> object(Foo)#2 (1) { ["foo":"Foo":private]=> NULL } } } }
Output for 7.4.0 - 7.4.33
array(1) { [0]=> array(4) { ["file"]=> string(9) "/in/lJ61X" ["line"]=> int(17) ["function"]=> string(7) "sprintf" ["args"]=> array(2) { [0]=> string(2) "%s" [1]=> object(Foo)#2 (1) { ["foo":"Foo":private]=> NULL } } } }

preferences:
150.78 ms | 402 KiB | 123 Q