array("a"=>"b","sort"=>"300"),"pokkom"=>array("a"=>"c","sort"=>"200")); function nikolaevevgeSort($ar=array(),$map=false,$type="string") { global $nikolaevevgeSortLastError; $nikolaevevgeSortLastError = ""; if (is_array($ar)) { $resultAr = array(); while (count($ar)) { $minValue = false; $minKey = false; foreach ($ar as $key => $value) { if (isset($value[$map])) {$tmp = $value[$map]."";} else {$tmp = "";}//Пока что только в string сравнивает if (($minValue === false) or ($tmp < $minValue)) { $minValue = $tmp; $minKey = $key; } } $resultAr[$minKey] = $ar[$minKey]; unset($ar[$minKey]); } return $resultAr; } return false; } var_dump($ar); var_dump(nikolaevevgeSort($ar,"sort","string"));