3v4l.org

run code in 300+ PHP versions simultaneously
<?php function arraysSum(array $arrays): array { return array_map(function(array $array): int { return array_sum($array); }, $arrays); } print_r(arraysSum([1,2,3], [4,5,6], [7,8,9]));
Output for 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Fatal error: Uncaught TypeError: {closure}(): Argument #1 ($array) must be of type array, int given in /in/IV8qs:4 Stack trace: #0 [internal function]: {closure}(1) #1 /in/IV8qs(4): array_map(Object(Closure), Array) #2 /in/IV8qs(9): arraysSum(Array, Array, Array) #3 {main} thrown in /in/IV8qs on line 4
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
Fatal error: Uncaught TypeError: {closure}(): Argument #1 ($array) must be of type array, int given in /in/IV8qs:4 Stack trace: #0 [internal function]: {closure}(1) #1 /in/IV8qs(6): array_map(Object(Closure), Array) #2 /in/IV8qs(9): arraysSum(Array, Array, Array) #3 {main} thrown in /in/IV8qs on line 4
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: Argument 1 passed to {closure}() must be of the type array, int given in /in/IV8qs:4 Stack trace: #0 [internal function]: {closure}(1) #1 /in/IV8qs(6): array_map(Object(Closure), Array) #2 /in/IV8qs(9): arraysSum(Array, Array, Array) #3 {main} thrown in /in/IV8qs on line 4
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33
Fatal error: Uncaught TypeError: Argument 1 passed to {closure}() must be of the type array, integer given in /in/IV8qs:4 Stack trace: #0 [internal function]: {closure}(1) #1 /in/IV8qs(6): array_map(Object(Closure), Array) #2 /in/IV8qs(9): arraysSum(Array, Array, Array) #3 {main} thrown in /in/IV8qs on line 4
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Parse error: syntax error, unexpected ':', expecting '{' in /in/IV8qs on line 2
Process exited with code 255.

preferences:
160.06 ms | 402 KiB | 215 Q