3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function foo(string $bar) { } } class B extends A { public function foo(object $bar) { } }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
Fatal error: Declaration of B::foo(object $bar) must be compatible with A::foo(string $bar) in /in/XBfik on line 10
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of B::foo(object $bar) should be compatible with A::foo(string $bar) in /in/XBfik on line 10
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Warning: Declaration of B::foo(object $bar) should be compatible with A::foo(string $bar) in /in/XBfik on line 12

preferences:
87.33 ms | 412 KiB | 6 Q