3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = array("apples", "oranges", "plums"); $nu = array_map( "do_something", $array); function do_something($item, $b) { print_r($b); exit; } var_dump($nu); ?>
based on sdN9a
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function do_something(), 1 passed and exactly 2 expected in /in/mllaY:6 Stack trace: #0 [internal function]: do_something('apples') #1 /in/mllaY(4): array_map('do_something', Array) #2 {main} thrown in /in/mllaY on line 6
Process exited with code 255.
Output for 5.3.22 - 7.0.20
Warning: Missing argument 2 for do_something() in /in/mllaY on line 6 Notice: Undefined variable: b in /in/mllaY on line 7