Sometimes i want to change this form of array

array(
  'position' => array('data1', 'data2'..)
  'year'     => array('year1', 'year2'..)
)

to this

array(0 => array('position' =>'data1',
                 'year' => 'year1'),

      1 => array('position' => 'data2',
                 'year' => 'year2')

Here is how i do it.

function array_group($data)
{
  $result = array();

  foreach($data as $key=>$rows)
     foreach($rows as $i=>$value)
         $result[$i][$key] = $value;
  
   return $result;
}