3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function x(): void {} } set_error_handler(function() { echo 'handled'; }); register_shutdown_function(function() { echo 'shutdown...'; }); echo 'before test...'; try { if (time() > 0) { // wrap in if to make sure an error is not throw at compile time class B extends A { public function x() {} } } } catch (\Throwable $e) { echo 'catched'; }
Output for 7.4.0 - 7.4.7
before test... Fatal error: Declaration of B::x() must be compatible with A::x(): void in /in/FMoCK on line 16 shutdown...
Process exited with code 255.
Output for 7.2.0 - 7.2.31, 7.3.0 - 7.3.19
before test... Fatal error: Declaration of B::x() must be compatible with A::x(): void in /in/FMoCK on line 15 shutdown...
Process exited with code 255.

preferences:
97.38 ms | 402 KiB | 65 Q