3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ex = [ 'goo' => [ 1, 2 ], 'asdads' => [ 3, 4 ] ]; $test = array_reduce($ex, function ($a, $b) { if (null === $a) { $a = []; } call_user_func_array('array_push', $b); return $a; }); var_dump($test);
Output for 8.4.1 - 8.4.14, 8.5.0 - 8.5.1
Warning: array_push(): Argument #1 ($array) must be passed by reference, value given in /in/qcuPh on line 16 Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, int given in /in/qcuPh:16 Stack trace: #0 /in/qcuPh(16): array_push(1, 2) #1 [internal function]: {closure:/in/qcuPh:11}(Array, Array) #2 /in/qcuPh(11): array_reduce(Array, Object(Closure)) #3 {main} thrown in /in/qcuPh on line 16
Process exited with code 255.
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.28
Warning: array_push(): Argument #1 ($array) must be passed by reference, value given in /in/qcuPh on line 16 Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, int given in /in/qcuPh:16 Stack trace: #0 /in/qcuPh(16): array_push(1, 2) #1 [internal function]: {closure}(Array, Array) #2 /in/qcuPh(11): array_reduce(Array, Object(Closure)) #3 {main} thrown in /in/qcuPh on line 16
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.33
Warning: array_push(): Argument #1 ($array) must be passed by reference, value given in /in/qcuPh on line 16 Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, int given in /in/qcuPh:16 Stack trace: #0 /in/qcuPh(16): array_push(1, 2) #1 [internal function]: {closure}(Array, Array) #2 /in/qcuPh(18): array_reduce(Array, Object(Closure)) #3 {main} thrown in /in/qcuPh on line 16
Process exited with code 255.
Output for 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
Warning: Parameter 1 to array_push() expected to be a reference, value given in /in/qcuPh on line 16 Warning: array_push() expects parameter 1 to be array, int given in /in/qcuPh on line 16 Warning: Parameter 1 to array_push() expected to be a reference, value given in /in/qcuPh on line 16 Warning: array_push() expects parameter 1 to be array, int given in /in/qcuPh on line 16 array(0) { }
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33
Warning: Parameter 1 to array_push() expected to be a reference, value given in /in/qcuPh on line 16 Warning: array_push() expects parameter 1 to be array, integer given in /in/qcuPh on line 16 Warning: Parameter 1 to array_push() expected to be a reference, value given in /in/qcuPh on line 16 Warning: array_push() expects parameter 1 to be array, integer given in /in/qcuPh on line 16 array(0) { }
Output for 5.6.0 - 5.6.25, 7.0.0 - 7.0.20
Warning: Parameter 1 to array_push() expected to be a reference, value given in /in/qcuPh on line 16 Warning: Parameter 1 to array_push() expected to be a reference, value given in /in/qcuPh on line 16 array(0) { }

preferences:
168.66 ms | 416 KiB | 5 Q