$arr[] = array('name'=>'a','flag'=>1);$arr[] = array('name'=>'b','flag'=>2);$arr[] = array('name'=>'a','flag'=>1);$flag=array();foreach($arr as $arr2){ $flag[]=$arr2["flag"]; }array_multisort($flag, SORT_ASC, $arr);print_r($arr);