3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ "entry" => [ "name" => [ 37 => [ "file" => "my-file-test.docx", ], 38 => [ "file" => "resources_views.php", ], ], "type" => [ 37 => [ "file" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document", ], 38 => [ "file" => "application/x-php", ], ], "tmp_name" => [ 37 => [ "file" => "/tmp/phpahucFZ", ], 38 => [ "file" => "/tmp/phptnDGQR", ], ], "error" => [ 37 => [ "file" => 0, ], 38 => [ "file" => 0, ], ], "size" => [ 37 => [ "file" => 12023, ], 38 => [ "file" => 18174, ], ], ], ]; $result = []; foreach ($arr['entry'] as $key => $value) { foreach ($value as $key1 => $value1) { $result[$key1][$key] = $value1['file']; } } print_r($result); //reset index demo print_r(array_values($result));
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0
Array ( [37] => Array ( [name] => my-file-test.docx [type] => application/vnd.openxmlformats-officedocument.wordprocessingml.document [tmp_name] => /tmp/phpahucFZ [error] => 0 [size] => 12023 ) [38] => Array ( [name] => resources_views.php [type] => application/x-php [tmp_name] => /tmp/phptnDGQR [error] => 0 [size] => 18174 ) ) Array ( [0] => Array ( [name] => my-file-test.docx [type] => application/vnd.openxmlformats-officedocument.wordprocessingml.document [tmp_name] => /tmp/phpahucFZ [error] => 0 [size] => 12023 ) [1] => Array ( [name] => resources_views.php [type] => application/x-php [tmp_name] => /tmp/phptnDGQR [error] => 0 [size] => 18174 ) )
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.

preferences:
134.16 ms | 408 KiB | 5 Q