Someone
public text v1 · immutablefunction arraySortByField($sourceArray, $field, $direction )
{
$sortArray = array();
foreach($sourceArray as $key => $value)
{
$sortArray[$key] = $value[$field];
}
asort($sortArray);
if($direction == 'desc')
{
$sortArray = array_reverse($sortArray, true);
}
$result = array();
foreach($sortArray as $key => $value)
{
$result = $sourceArray[$key];
}
return $result;