3v4l.org

run code in 300+ PHP versions simultaneously
<?php $insertData = [ [ 'test' => '1', 'test1' => '2', ], [ 'test' => '3', 'test1' => '4', ] ]; $values = array_map(fn (array $row) => array_push($values, ...array_values($row)), $insertData); var_dump( ($values), );
Output for 8.4.1 - 8.4.2
Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, null given in /in/ef86V:14 Stack trace: #0 /in/ef86V(14): array_push(NULL, '1', '2') #1 [internal function]: {closure:/in/ef86V:14}(Array) #2 /in/ef86V(14): array_map(Object(Closure), Array) #3 {main} thrown in /in/ef86V on line 14
Process exited with code 255.
Output for 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.15
Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, null given in /in/ef86V:14 Stack trace: #0 /in/ef86V(14): array_push(NULL, '1', '2') #1 [internal function]: {closure}(Array) #2 /in/ef86V(14): array_map(Object(Closure), Array) #3 {main} thrown in /in/ef86V on line 14
Process exited with code 255.

preferences:
39.67 ms | 408 KiB | 5 Q