3v4l.org

run code in 500+ PHP versions simultaneously
<?php /* set_error_handler(function($errno, $errstr, $errfile, $errline) { echo "caught"; return true; }); */ class A { public function __destruct() { echo "in destructor"; } } function foo(object $o) { trigger_error('foo', E_USER_ERROR); } $o = new A; foo($o); echo "after";
Output for 8.5.0 - 8.5.3
Deprecated: Passing E_USER_ERROR to trigger_error() is deprecated since 8.4, throw an exception or call exit with a string message instead in /in/J5NXF on line 16 Fatal error: foo in /in/J5NXF on line 16 Stack trace: #0 /in/J5NXF(16): trigger_error('foo', 256) #1 /in/J5NXF(20): foo(Object(A)) #2 {main}
Process exited with code 255.
Output for 8.4.1 - 8.4.18
Deprecated: Passing E_USER_ERROR to trigger_error() is deprecated since 8.4, throw an exception or call exit with a string message instead in /in/J5NXF on line 16 Fatal error: foo in /in/J5NXF on line 16
Process exited with code 255.
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30
Fatal error: foo in /in/J5NXF on line 16
Process exited with code 255.

preferences:
62.08 ms | 984 KiB | 4 Q