note 83861 deleted from function.natsort by tomsommer
| From: | tomsommer@php.net | Date: | Tue, 02 Jun 2009 06:55:09 +0000 |
| Subject: | note 83861 deleted from function.natsort by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156267@lists.php.net to get a copy of this message | ||
Note Submitter: shane.f.carr at mac dot com
----
Here is a natsort that will sort the array based on keys (it is similar to the function posted
earlier on 04-May-2006).
<?php
function knatsort(&$karr){
$kkeyarr = array_keys($karr);
natsort($kkeyarr);
$ksortedarr = array();
foreach($kkeyarr as $kcurrkey){
$ksortedarr[$kcurrkey] = $karr[$kcurrkey];
}
$karr = $ksortedarr;
return true;
}
?>