3v4l.org

run code in 300+ PHP versions simultaneously
<?php class bar { public function handleException(\Throwable $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.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
Fatal error: Declaration of foo::handleException(Exception $e) must be compatible with bar::handleException(Throwable $e) in /in/RlS0n 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(Throwable $e) in /in/RlS0n on line 8 Fatal error: Uncaught Error: Call to undefined method Exception::message() in /in/RlS0n:9 Stack trace: #0 /in/RlS0n(13): foo->handleException(Object(Exception)) #1 {main} thrown in /in/RlS0n 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(Throwable $e) in /in/RlS0n on line 11 Fatal error: Uncaught Error: Call to undefined method Exception::message() in /in/RlS0n:9 Stack trace: #0 /in/RlS0n(13): foo->handleException(Object(Exception)) #1 {main} thrown in /in/RlS0n on line 9
Process exited with code 255.

preferences:
87.95 ms | 409 KiB | 5 Q