3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function foo1($a=null, $b) { printf('foo1: %s, %s', var_export($a, true), var_export($b, true)); } function foo2($a, $b=null, $c) { printf('foo2: %s, %s, %s', var_export($a, true), var_export($b, true), var_export($c, true)); } foo1(1, 2); foo1(3); foo2(4); foo2(4, 5); foo2(4, 5, 6);
based on 3M0nL
Output for 7.1.0
foo1: 1, 2 Fatal error: Uncaught ArgumentCountError: Too few arguments to function foo1(), 1 passed in /in/hEt0u on line 12 and exactly 2 expected in /in/hEt0u:3 Stack trace: #0 /in/hEt0u(12): foo1(3) #1 {main} thrown in /in/hEt0u on line 3
Process exited with code 255.
Output for 5.1.0 - 5.6.28, 7.0.0 - 7.0.14
foo1: 1, 2 Warning: Missing argument 2 for foo1(), called in /in/hEt0u on line 12 and defined in /in/hEt0u on line 3 Notice: Undefined variable: b in /in/hEt0u on line 4 foo1: 3, NULL Warning: Missing argument 3 for foo2(), called in /in/hEt0u on line 14 and defined in /in/hEt0u on line 7 Notice: Undefined variable: c in /in/hEt0u on line 8 foo2: 4, NULL, NULL Warning: Missing argument 3 for foo2(), called in /in/hEt0u on line 15 and defined in /in/hEt0u on line 7 Notice: Undefined variable: c in /in/hEt0u on line 8 foo2: 4, 5, NULLfoo2: 4, 5, 6
Output for hhvm-3.10.0 - 3.12.0
foo1: 1, 2 Warning: foo1() expects exactly 2 parameters, 1 given in /in/hEt0u on line 4 Notice: Undefined variable: b in /in/hEt0u on line 4 foo1: 3, NULL Warning: foo2() expects exactly 3 parameters, 1 given in /in/hEt0u on line 7 Notice: Undefined variable: c in /in/hEt0u on line 8 foo2: 4, NULL, NULL Warning: foo2() expects exactly 3 parameters, 2 given in /in/hEt0u on line 8 Notice: Undefined variable: c in /in/hEt0u on line 8 foo2: 4, 5, NULLfoo2: 4, 5, 6
Output for 4.3.0 - 5.0.5
foo1: 1, 2 Warning: Missing argument 2 for foo1() in /in/hEt0u on line 3 foo1: 3, NULL Warning: Missing argument 3 for foo2() in /in/hEt0u on line 7 foo2: 4, NULL, NULL Warning: Missing argument 3 for foo2() in /in/hEt0u on line 7 foo2: 4, 5, NULLfoo2: 4, 5, 6