note 61976 deleted from function.array-multisort by cmb
| From: | cmb@php.net | Date: | Sun, 29 Dec 2019 10:27:38 +0000 |
| Subject: | note 61976 deleted from function.array-multisort by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213680@lists.php.net to get a copy of this message | ||
Note Submitter: peter dot graham at tcat dot ac dot uk
----
Many thanks to AlberT at SuperAlberT dot it for his useful and elegant function. I have made
some small alterations so it doesnt use pass-by-reference as this throws up warnings in newer
versions of php4.
<?php
function array_key_multi_sort($arr, $l , $f='strnatcasecmp')
{
usort($arr, create_function('$a, $b', "return $f(\$a['$l'],
\$b['$l']);"));
return($arr);
}
?>