: This article describes how to sort php multi-dimensional arrays. For more information about PHP tutorials, see.
$aProduct = array( 0=> array('goods_id' => 1,'name' =>'iPhone 4','is_group' =>4), 1=> array('goods_id' => 2,'name' =>'iPhone 4s','is_group' =>6), 2=> array('goods_id' => 3,'name' =>'iPhone 5','is_group' =>1), 3=> array('goods_id' => 4,'name' =>'iPhone 5s','is_group' =>1));function arraySort($multi_array,$sort_key,$sort=SORT_ASC){ if(is_array($multi_array)){ foreach ($multi_array as $row_array){ if(is_array($row_array)){ $key_array[] = $row_array[$sort_key]; }else{ return false; } } }else{ return false; } array_multisort($key_array,$sort,$multi_array); return $multi_array;}print_r(arraySort($aProduct,'is_group',SORT_DESC));exit;Http://www.ruesin.com/php/array_multisort-12.html
The preceding section describes the sorting of php multi-dimensional arrays, including the following content. if you are interested in the PHP Tutorial, please help.