3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = Array ( [0] => Array ( [1] => 2 ) [1] => Array ( [1] => 2 ) [2] => Array ( [2] => 1 ) [3] => Array ( [3] => 1 ) ); array_reduce($arr, function(&$current, $item) { foreach ($item as $key => $value) { if (!isset($current[$key])) { $current[$key] = 0; } $current[$key] += $value; } return $current; }, []);
Output for 5.4.0 - 5.4.26
Parse error: syntax error, unexpected '[', expecting ')' in /in/s0BVi on line 10
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected '[', expecting ')' in /in/s0BVi on line 5
Process exited with code 255.

preferences:
179.63 ms | 1395 KiB | 63 Q