3v4l.org

run code in 300+ PHP versions simultaneously
<?php $success=false; if (true) { set_error_handler(function($a, $b, $c, $d) { var_dump('error_handler', $a, $b, $c, $d); throw new ErrorException($a, $b, $c, $d); }); register_shutdown_function(function(){ if ($GLOBALS['success']){return;} var_dump('shutdown_function', error_get_last()); }); } $var = 1; try { $var->method(); // Throws an Error object in PHP 7. // $buf.='nyanpasu'; /* } catch (Error $e) { // Handle error var_dump('error', $e); */ } catch (Exception $e) { // Handle error var_dump('exception', $e); } $success=true; ?>
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Call to a member function method() on int in /in/BqK9U:18 Stack trace: #0 {main} thrown in /in/BqK9U on line 18 string(17) "shutdown_function" array(4) { ["type"]=> int(1) ["message"]=> string(105) "Uncaught Error: Call to a member function method() on int in /in/BqK9U:18 Stack trace: #0 {main} thrown" ["file"]=> string(9) "/in/BqK9U" ["line"]=> int(18) }
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33
Fatal error: Uncaught Error: Call to a member function method() on integer in /in/BqK9U:18 Stack trace: #0 {main} thrown in /in/BqK9U on line 18 string(17) "shutdown_function" array(4) { ["type"]=> int(1) ["message"]=> string(109) "Uncaught Error: Call to a member function method() on integer in /in/BqK9U:18 Stack trace: #0 {main} thrown" ["file"]=> string(9) "/in/BqK9U" ["line"]=> int(18) }
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Fatal error: Call to a member function method() on integer in /in/BqK9U on line 18 string(17) "shutdown_function" array(4) { ["type"]=> int(1) ["message"]=> string(45) "Call to a member function method() on integer" ["file"]=> string(9) "/in/BqK9U" ["line"]=> int(18) }
Process exited with code 255.
Output for 5.5.24 - 5.5.35
Fatal error: Call to a member function method() on a non-object in /in/BqK9U on line 18 string(17) "shutdown_function" array(4) { ["type"]=> int(1) ["message"]=> string(50) "Call to a member function method() on a non-object" ["file"]=> string(9) "/in/BqK9U" ["line"]=> int(18) }
Process exited with code 255.

preferences:
164.12 ms | 401 KiB | 213 Q