3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function foo1($a=null, $b) { var_dump($a); var_dump($b); } function foo2($a, $b=null, $c) { var_dump($a); var_dump($b); var_dump($c); } foo1(1, 2); foo1(3); foo2(4); foo2(4, 5); foo2(4, 5, 6);
based on UHq5D
Output for 7.1.0
int(1) int(2) Fatal error: Uncaught ArgumentCountError: Too few arguments to function foo1(), 1 passed in /in/2Gk8K on line 15 and exactly 2 expected in /in/2Gk8K:3 Stack trace: #0 /in/2Gk8K(15): foo1(3) #1 {main} thrown in /in/2Gk8K on line 3
Process exited with code 255.
Output for 5.1.0 - 7.0.14
int(1) int(2) Warning: Missing argument 2 for foo1(), called in /in/2Gk8K on line 15 and defined in /in/2Gk8K on line 3 int(3) Notice: Undefined variable: b in /in/2Gk8K on line 5 NULL Warning: Missing argument 3 for foo2(), called in /in/2Gk8K on line 17 and defined in /in/2Gk8K on line 8 int(4) NULL Notice: Undefined variable: c in /in/2Gk8K on line 11 NULL Warning: Missing argument 3 for foo2(), called in /in/2Gk8K on line 18 and defined in /in/2Gk8K on line 8 int(4) int(5) Notice: Undefined variable: c in /in/2Gk8K on line 11 NULL int(4) int(5) int(6)
Output for 4.3.0 - 5.0.5
int(1) int(2) Warning: Missing argument 2 for foo1() in /in/2Gk8K on line 3 int(3) NULL Warning: Missing argument 3 for foo2() in /in/2Gk8K on line 8 int(4) NULL NULL Warning: Missing argument 3 for foo2() in /in/2Gk8K on line 8 int(4) int(5) NULL int(4) int(5) int(6)