3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ( 'name' => array ( 0 => 'test1', 1 => 'test2' ), 'type' => array ( 0 => 'image/jpeg', 1 => 'image/jpeg' ), 'tmp_name' => array ( 0 => 'D:\xampp5\tmp\php5F43.tmp', 1 => 'D:\xampp5\tmp\php5F63.tmp' ), 'error' => array ( 0 => 0, 1 => 0 ), 'size' => array ( 0 => 49293, 1 => 20286 ) ); $result = array(); foreach (array_keys(current($array)) as $key) { $result[$key] = array_combine(array_keys($array), array_column($array, $key)); } print_r($result);

preferences:
25.83 ms | 409 KiB | 5 Q