function array_sort($arr ,$keys,$order=0){
if(!is_array($arr)){
return false;
}
$keysvalue=array();
foreach ($arr as $key=>$val){
$keysvalue[$key]=$val[$keys];
}
if($order==0){
asort($keysvalue);
}else{
arsort($keysvalue);
}
foreach ( $keysvalue as $key=>$vals){
$keysort[$key]=$key;
}
echo 'keysort='.var_dump($keysort);
$new_array=array();
foreach ($keysort as $key=>$val){
$new_array[$key]=$arr[$val];
}
return $new_array;
}
$t=array( array('id'=>2,'name'=>'teswt'), array('id'=>3,'name'=>'2teswt'),array('id'=>1,'name'=>'3teswt'));
var_dump(array_sort($t, 'id',1)) ;