3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = array( 'a' => array( 1 => 'a1', 2 => 'a2', 3 => 'a3' ), 'b' => array( 1 => 'b1', 2 => 'b2', 3 => 'b3' ), 'c' => array( 1 => 'c1', 2 => 'c2', 3 => 'c3' ) ); function transpose($a) { if (count($a) < 2) return $a; return array_map(null, ...$a); } var_export(transpose($foo));
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
Fatal error: Uncaught ArgumentCountError: array_map() expects at least 2 arguments, 1 given in /in/Qo8Ea:23 Stack trace: #0 /in/Qo8Ea(23): array_map(NULL, a: Array, b: Array, c: Array) #1 /in/Qo8Ea(26): transpose(Array) #2 {main} thrown in /in/Qo8Ea on line 23
Process exited with code 255.
Output for 7.2.34, 7.3.33, 7.4.33
Fatal error: Uncaught Error: Cannot unpack array with string keys in /in/Qo8Ea:23 Stack trace: #0 /in/Qo8Ea(26): transpose(Array) #1 {main} thrown in /in/Qo8Ea on line 23
Process exited with code 255.
Output for 5.6.40
Catchable fatal error: Cannot unpack array with string keys in /in/Qo8Ea on line 23
Process exited with code 255.

preferences:
103.18 ms | 408 KiB | 5 Q