对于每个用于提取数据的循环

I have following array that contains information on each file.but it is in single array. I want to convert into an array that single index of an array contains an array of single image

array
(
    'name' => array
    (
        '0' => '262702_221069867927769_100000742738048_692998_2241181_n.jpg'
        '1' => '423541_261124687295172_100001929282529_556902_941592773_n.jpg'
    )
    'type' => array
    (
        '0' => 'image/jpeg'
        '1' => 'image/jpeg'
    )
    'tmp_name' => array
    (
        '0' => 'C:\\wamp\\tmp\\phpB0.tmp'
        '1' => 'C:\\wamp\\tmp\\phpB1.tmp'
    )
    'error' => array
    (
        '0' => 0
        '1' => 0
    )
    'size' => array
    (
        '0' => 66699
        '1' => 12013
    )
)

what i am looking is to convert it in format

    array{
    '0'=>array{
    'name'=>'262702_221069867927769_100000742738048_692998_2241181_n.jpg',
    'type'=>'image/jpeg',
    .....
    ...
    ...}
    '1'=>'0'=>array{
    'name'=>'262702_221069867927769_100000742738048_692998_2241181_n.jpg',
    'type'=>'image/jpeg',
    .....
    ...
   ...}
}

i cant make up any nice algo can anyone help me?

$newArray = array();

foreach($oldArray as $indexName=>$values) {
   foreach($values as $index=>$value) {
        $new = &$newArray[$index];
        if(!isset($new))
           $new = array();
        $new[$indexName] = $value;
   }
}

print_r($newArray);

Or something like that.

Demo: http://codepad.org/lxDkTLlg

$new_array = array();
foreach ($array as $attr => $img_data)
{
    foreach ($img_data as $i => $attr_value)
    {
        $new_array[$i][$attr] = $attr_value;
    }   
}

maybe this will help ... (considering the $actualArray is your original array ...

$new = array();
foreach($actualArray as $kFather => $vFather) {
    foreach ($vFather as $key => $value) {
        $new[] = array($kFather => $value);
    }
}

By the way, dont forget to use ',' to separate your array's elements