This code is taken from http://php.net/manual/en/function.asort.php
The function works well but looses the original array indices.
function aSortBySecondIndex($multiArray, $secondIndex)
// sorts array by the specified index name
{
while (list($firstIndex, ) = each($multiArray))
$indexMap[$firstIndex] = $multiArray[$firstIndex][$secondIndex];
asort($indexMap);
while (list($firstIndex, ) = each($indexMap))
if (is_numeric($firstIndex))
$sortedArray[] = $multiArray[$firstIndex];
else $sortedArray[$firstIndex] = $multiArray[$firstIndex];
return $sortedArray;
}