I have one multidimensional array as shown below(PHP) :
Array
(
    [144320] => Array
        (
            [3568728] => Array
                (
                    [30832] => 30832
                )
            [3568884] => Array
                (
                    [30827] => 30827
                    [30828] => 30828
                    [30830] => 30830
                    [30831] => 30831
                    [30832] => 30832
                    [30837] => 30837
                    [30838] => 30838
                    [30839] => 30839
                    [30826] => 30826
                    [30808] => 30808
                    [30806] => 30806
                    [30807] => 30807
                    [30698] => 30698
                    [30601] => 30601
                    [30697] => 30697
                )
        )
    [144330] => Array
        (
            [3568731] => Array
                (
                    [30827] => 30827
                    [30839] => 30839
                    [30838] => 30838
                    [30837] => 30837
                    [30832] => 30832
                    [30831] => 30831
                    [30828] => 30828
                    [30830] => 30830
                    [30826] => 30826
                    [30806] => 30806
                    [30808] => 30808
                    [30807] => 30807
                    [30698] => 30698
                    [30697] => 30697
                    [30601] => 30601
                )
        )
    [144218] => Array
        (
            [3568753] => Array
                (
                    [30808] => 30808
                )
        )
    [144216] => Array
        (
            [3568732] => Array
                (
                    [30808] => 30808
                )
        )
)
This array is populated by following code:
$sql = "SELECT * FROM `bf_alert_stack` WHERE `type` = 'immediately'  order by created desc";
$q   = db_query($sql);
$user_alerts = array();
  while ($row  = db_fetch_array($q)) 
{   
   $user_alerts [$row['uid']]    [$row['alert_id']]  [$row['nid']] = $row['nid'];
}
From the above user_alerts array I want to rearrange the [$row['nid']] array and for rearrangement I want capture [$row['nid']] array and after capturing it into another array I want to re-arrange $row['nid'] array I want to update this $row['nid'] array into original user_alerts array.
How I can do this? I am not getting any search for this on google so just placed this on appropriate place.
 
    