3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo extends Exception { public function __construct() { var_dump('constructed'); } } assert(false, new Foo());
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
string(11) "constructed" Fatal error: Uncaught Foo in /in/GU50j:9 Stack trace: #0 {main} thrown in /in/GU50j on line 9
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
string(11) "constructed" Warning: assert(): Foo in /in/GU50j:9 Stack trace: #0 {main} failed in /in/GU50j on line 9
Output for 5.4.8 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
string(11) "constructed" Warning: assert(): exception 'Foo' in /in/GU50j:9 Stack trace: #0 {main} failed in /in/GU50j on line 9
Output for 5.4.0 - 5.4.7
string(11) "constructed" Warning: assert() expects exactly 1 parameter, 2 given in /in/GU50j on line 9

preferences:
289.03 ms | 401 KiB | 370 Q