3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public function something($param1, $param2 = array()) { var_dump($param1, $param2); } } class Bar extends Foo { public function something($param1, $param3, $param2) { return parent::something($param1, $param2); } } $test = new Bar(); $test->something('param111');
based on N480h
Output for 7.1.0 - 7.2.0
Warning: Declaration of Bar::something($param1, $param3, $param2) should be compatible with Foo::something($param1, $param2 = Array) in /in/ukgpr on line 17 Fatal error: Uncaught ArgumentCountError: Too few arguments to function Bar::something(), 1 passed in /in/ukgpr on line 20 and exactly 3 expected in /in/ukgpr:13 Stack trace: #0 /in/ukgpr(20): Bar->something('param111') #1 {main} thrown in /in/ukgpr on line 13
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Warning: Declaration of Bar::something($param1, $param3, $param2) should be compatible with Foo::something($param1, $param2 = Array) in /in/ukgpr on line 17 Warning: Missing argument 2 for Bar::something(), called in /in/ukgpr on line 20 and defined in /in/ukgpr on line 13 Warning: Missing argument 3 for Bar::something(), called in /in/ukgpr on line 20 and defined in /in/ukgpr on line 13 Notice: Undefined variable: param2 in /in/ukgpr on line 15 string(8) "param111" NULL
Output for 5.4.10 - 5.6.21
Strict Standards: Declaration of Bar::something() should be compatible with Foo::something($param1, $param2 = Array) in /in/ukgpr on line 17 Warning: Missing argument 2 for Bar::something(), called in /in/ukgpr on line 20 and defined in /in/ukgpr on line 13 Warning: Missing argument 3 for Bar::something(), called in /in/ukgpr on line 20 and defined in /in/ukgpr on line 13 Notice: Undefined variable: param2 in /in/ukgpr on line 15 string(8) "param111" NULL
Output for 5.3.20 - 5.3.29
Strict Standards: Declaration of Bar::something() should be compatible with that of Foo::something() in /in/ukgpr on line 17 Warning: Missing argument 2 for Bar::something(), called in /in/ukgpr on line 20 and defined in /in/ukgpr on line 13 Warning: Missing argument 3 for Bar::something(), called in /in/ukgpr on line 20 and defined in /in/ukgpr on line 13 Notice: Undefined variable: param2 in /in/ukgpr on line 15 string(8) "param111" NULL