3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a { public $retorno; public function test() { try { throw new Exception('Error!'); } catch(Exception $e) { $this->retorno = 'mensagem!'; } } public function response($e) { echo $this->retorno; } public function __destruct() { $this->response(); } } $a = new a; $a->test();
Output for 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 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 ArgumentCountError: Too few arguments to function a::response(), 0 passed in /in/a8LnB on line 23 and exactly 1 expected in /in/a8LnB:16 Stack trace: #0 /in/a8LnB(23): a->response() #1 [internal function]: a->__destruct() #2 {main} thrown in /in/a8LnB on line 16
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20
Warning: Missing argument 1 for a::response(), called in /in/a8LnB on line 23 and defined in /in/a8LnB on line 16 mensagem!

preferences:
163.79 ms | 402 KiB | 198 Q