3v4l.org

run code in 500+ PHP versions simultaneously
<?php class bar { public function handleException($e){ echo $e->message(); } } class foo extends bar { public function handleException(\Exception $e) { echo $e->message(); } } $f = new foo(); $f->handleException(new \Exception('whoops'));
Output for 8.5.0 - 8.5.3
Fatal error: Declaration of foo::handleException(Exception $e) must be compatible with bar::handleException($e) in /in/rIOsE on line 8 Stack trace: #0 {main}
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18
Fatal error: Declaration of foo::handleException(Exception $e) must be compatible with bar::handleException($e) in /in/rIOsE on line 8
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of foo::handleException(Exception $e) should be compatible with bar::handleException($e) in /in/rIOsE on line 8 Fatal error: Uncaught Error: Call to undefined method Exception::message() in /in/rIOsE:9 Stack trace: #0 /in/rIOsE(13): foo->handleException(Object(Exception)) #1 {main} thrown in /in/rIOsE on line 9
Process exited with code 255.
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.33
Warning: Declaration of foo::handleException(Exception $e) should be compatible with bar::handleException($e) in /in/rIOsE on line 11 Fatal error: Uncaught Error: Call to undefined method Exception::message() in /in/rIOsE:9 Stack trace: #0 /in/rIOsE(13): foo->handleException(Object(Exception)) #1 {main} thrown in /in/rIOsE on line 9
Process exited with code 255.

preferences:
74.47 ms | 1532 KiB | 3 Q