3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { function test() { var_dump('super class'); } } class B extends A { function test($a) { var_dump('inherited class'); } } $b = new B; $b->test(); $b->test(1);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Declaration of B::test($a) must be compatible with A::test() in /in/FDKbO on line 9
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of B::test($a) should be compatible with A::test() in /in/FDKbO on line 9 Fatal error: Uncaught ArgumentCountError: Too few arguments to function B::test(), 0 passed in /in/FDKbO on line 15 and exactly 1 expected in /in/FDKbO:9 Stack trace: #0 /in/FDKbO(15): B->test() #1 {main} thrown in /in/FDKbO on line 9
Process exited with code 255.
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33
Warning: Declaration of B::test($a) should be compatible with A::test() in /in/FDKbO on line 12 Fatal error: Uncaught ArgumentCountError: Too few arguments to function B::test(), 0 passed in /in/FDKbO on line 15 and exactly 1 expected in /in/FDKbO:9 Stack trace: #0 /in/FDKbO(15): B->test() #1 {main} thrown in /in/FDKbO on line 9
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Warning: Declaration of B::test($a) should be compatible with A::test() in /in/FDKbO on line 12 Warning: Missing argument 1 for B::test(), called in /in/FDKbO on line 15 and defined in /in/FDKbO on line 9 string(15) "inherited class" string(15) "inherited class"
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Strict Standards: Declaration of B::test() should be compatible with A::test() in /in/FDKbO on line 12 Warning: Missing argument 1 for B::test(), called in /in/FDKbO on line 15 and defined in /in/FDKbO on line 9 string(15) "inherited class" string(15) "inherited class"
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Strict Standards: Declaration of B::test() should be compatible with that of A::test() in /in/FDKbO on line 12 Warning: Missing argument 1 for B::test(), called in /in/FDKbO on line 15 and defined in /in/FDKbO on line 9 string(15) "inherited class" string(15) "inherited class"
Output for 5.0.0 - 5.0.5
Strict Standards: Declaration of B::test() should be compatible with that of A::test() in /in/FDKbO on line 12 Warning: Missing argument 1 for B::test() in /in/FDKbO on line 9 string(15) "inherited class" string(15) "inherited class"
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9
Warning: Missing argument 1 for test() in /in/FDKbO on line 9 string(15) "inherited class" string(15) "inherited class"

preferences:
235.02 ms | 402 KiB | 310 Q