3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class foo { public function bar($a) { echo "$a $b"; } } class baz extends foo { public function bar($a, $b) { echo "$b $a"; } } $bar = new baz; $bar->bar();
Output for 7.1.0 - 7.2.0
Warning: Declaration of baz::bar($a, $b) should be compatible with foo::bar($a) in /in/QQ3AU on line 13 Fatal error: Uncaught ArgumentCountError: Too few arguments to function baz::bar(), 0 passed in /in/QQ3AU on line 16 and exactly 2 expected in /in/QQ3AU:10 Stack trace: #0 /in/QQ3AU(16): baz->bar() #1 {main} thrown in /in/QQ3AU on line 10
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Warning: Declaration of baz::bar($a, $b) should be compatible with foo::bar($a) in /in/QQ3AU on line 13 Warning: Missing argument 1 for baz::bar(), called in /in/QQ3AU on line 16 and defined in /in/QQ3AU on line 10 Warning: Missing argument 2 for baz::bar(), called in /in/QQ3AU on line 16 and defined in /in/QQ3AU on line 10 Notice: Undefined variable: b in /in/QQ3AU on line 11 Notice: Undefined variable: a in /in/QQ3AU on line 11
Output for 5.4.2 - 5.6.28
Strict Standards: Declaration of baz::bar() should be compatible with foo::bar($a) in /in/QQ3AU on line 13 Warning: Missing argument 1 for baz::bar(), called in /in/QQ3AU on line 16 and defined in /in/QQ3AU on line 10 Warning: Missing argument 2 for baz::bar(), called in /in/QQ3AU on line 16 and defined in /in/QQ3AU on line 10 Notice: Undefined variable: b in /in/QQ3AU on line 11 Notice: Undefined variable: a in /in/QQ3AU on line 11
Output for 5.3.17 - 5.3.29
Strict Standards: Declaration of baz::bar() should be compatible with that of foo::bar() in /in/QQ3AU on line 13 Warning: Missing argument 1 for baz::bar(), called in /in/QQ3AU on line 16 and defined in /in/QQ3AU on line 10 Warning: Missing argument 2 for baz::bar(), called in /in/QQ3AU on line 16 and defined in /in/QQ3AU on line 10 Notice: Undefined variable: b in /in/QQ3AU on line 11 Notice: Undefined variable: a in /in/QQ3AU on line 11