3v4l.org

run code in 300+ PHP versions simultaneously
<?php function addArrays() { return array_sum(func_get_args()); } $output = array(0,0,0,0,0); $testdata = "580,680,480,380"; $input = array_push(explode(",", $testdata),array_sum(explode(",", $testdata))); $output = array_map(addArrays(), $output, $input); var_dump(output); ?>
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Notice: Only variables should be passed by reference in /in/cPkdM on line 9 Fatal error: Uncaught TypeError: array_map(): Argument #1 ($callback) must be a valid callback or null, no array or string given in /in/cPkdM:10 Stack trace: #0 /in/cPkdM(10): array_map(0, Array, 5) #1 {main} thrown in /in/cPkdM on line 10
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Notice: Only variables should be passed by reference in /in/cPkdM on line 9 Fatal error: Uncaught TypeError: array_map(): Argument #1 ($callback) must be a valid callback, no array or string given in /in/cPkdM:10 Stack trace: #0 /in/cPkdM(10): array_map(0, Array, 5) #1 {main} thrown in /in/cPkdM on line 10
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
Notice: Only variables should be passed by reference in /in/cPkdM on line 9 Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in /in/cPkdM on line 10 Warning: Use of undefined constant output - assumed 'output' (this will throw an Error in a future version of PHP) in /in/cPkdM on line 11 string(6) "output"
Output for 7.3.32 - 7.3.33
Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in /in/cPkdM on line 10 Warning: Use of undefined constant output - assumed 'output' (this will throw an Error in a future version of PHP) in /in/cPkdM on line 11 string(6) "output"
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20
Notice: Only variables should be passed by reference in /in/cPkdM on line 9 Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in /in/cPkdM on line 10 Notice: Use of undefined constant output - assumed 'output' in /in/cPkdM on line 11 string(6) "output"
Output for 5.4.1 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Strict Standards: Only variables should be passed by reference in /in/cPkdM on line 9 Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in /in/cPkdM on line 10 Notice: Use of undefined constant output - assumed 'output' in /in/cPkdM on line 11 string(6) "output"

preferences:
170.27 ms | 402 KiB | 227 Q