3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function f($req, $opt = null, $params) { printf('$req: %d; $opt: %d; number of params: %d'."\n", $req, $opt, count($params)); var_dump($params); } f(1); f(1, 2); f(1, 2, 3); f(1, 2, 3, 4); f(1, 2, 3, 4, 5); ?>
Output for 7.1.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function f(), 1 passed in /in/S2Nra on line 8 and exactly 3 expected in /in/S2Nra:2 Stack trace: #0 /in/S2Nra(8): f(1) #1 {main} thrown in /in/S2Nra on line 2
Process exited with code 255.
Output for 7.0.0 - 7.0.14
Warning: Missing argument 3 for f(), called in /in/S2Nra on line 8 and defined in /in/S2Nra on line 2 Notice: Undefined variable: params in /in/S2Nra on line 3 $req: 1; $opt: 0; number of params: 0 Notice: Undefined variable: params in /in/S2Nra on line 5 NULL Warning: Missing argument 3 for f(), called in /in/S2Nra on line 9 and defined in /in/S2Nra on line 2 Notice: Undefined variable: params in /in/S2Nra on line 3 $req: 1; $opt: 2; number of params: 0 Notice: Undefined variable: params in /in/S2Nra on line 5 NULL $req: 1; $opt: 2; number of params: 1 int(3) $req: 1; $opt: 2; number of params: 1 int(3) $req: 1; $opt: 2; number of params: 1 int(3)
Output for 5.1.0 - 5.6.28
Warning: Missing argument 3 for f(), called in /in/S2Nra on line 8 and defined in /in/S2Nra on line 2 Notice: Undefined variable: params in /in/S2Nra on line 4 $req: 1; $opt: 0; number of params: 0 Notice: Undefined variable: params in /in/S2Nra on line 5 NULL Warning: Missing argument 3 for f(), called in /in/S2Nra on line 9 and defined in /in/S2Nra on line 2 Notice: Undefined variable: params in /in/S2Nra on line 4 $req: 1; $opt: 2; number of params: 0 Notice: Undefined variable: params in /in/S2Nra on line 5 NULL $req: 1; $opt: 2; number of params: 1 int(3) $req: 1; $opt: 2; number of params: 1 int(3) $req: 1; $opt: 2; number of params: 1 int(3)
Output for 4.3.0 - 5.0.5
Warning: Missing argument 3 for f() in /in/S2Nra on line 2 $req: 1; $opt: 0; number of params: 0 NULL Warning: Missing argument 3 for f() in /in/S2Nra on line 2 $req: 1; $opt: 2; number of params: 0 NULL $req: 1; $opt: 2; number of params: 1 int(3) $req: 1; $opt: 2; number of params: 1 int(3) $req: 1; $opt: 2; number of params: 1 int(3)