3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public function aa(int $a) { echo $a; } } class B extends A { public function aa(int $a, float $b) { echo $a; } } $a = new B(); $a->aa(1);
based on 0kmWc
Output for 7.1.0 - 7.2.0
Warning: Declaration of B::aa(int $a, float $b) should be compatible with A::aa(int $a) in /in/Z108c on line 14 Fatal error: Uncaught ArgumentCountError: Too few arguments to function B::aa(), 1 passed in /in/Z108c on line 17 and exactly 2 expected in /in/Z108c:11 Stack trace: #0 /in/Z108c(17): B->aa(1) #1 {main} thrown in /in/Z108c on line 11
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Warning: Declaration of B::aa(int $a, float $b) should be compatible with A::aa(int $a) in /in/Z108c on line 14 Fatal error: Uncaught TypeError: Argument 2 passed to B::aa() must be of the type float, none given, called in /in/Z108c on line 17 and defined in /in/Z108c:11 Stack trace: #0 /in/Z108c(17): B->aa(1) #1 {main} thrown in /in/Z108c on line 11
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Strict Standards: Declaration of B::aa() should be compatible with A::aa(int $a) in /in/Z108c on line 14 Catchable fatal error: Argument 1 passed to B::aa() must be an instance of int, integer given, called in /in/Z108c on line 17 and defined in /in/Z108c on line 11
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Strict Standards: Declaration of B::aa() should be compatible with that of A::aa() in /in/Z108c on line 14 Catchable fatal error: Argument 1 passed to B::aa() must be an instance of int, integer given, called in /in/Z108c on line 17 and defined in /in/Z108c on line 11
Process exited with code 255.