note 65620 deleted from function.natsort by tomsommer
| From: | tomsommer@php.net | Date: | Tue, 02 Jun 2009 06:55:48 +0000 |
| Subject: | note 65620 deleted from function.natsort by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156269@lists.php.net to get a copy of this message | ||
Note Submitter: nissar_pa at yahoo dot com
----
Here is the program which will sort an array key in natural order and maintains key to data
correlations
function natSortKey(&$arrIn)
{
$key_array = array();
$arrOut = array();
foreach ( $arrIn as $key=>$value ) {
$key_array[]=$key;
}
natsort( $key_array);
foreach ( $key_array as $key=>$value ) {
$arrOut[$value]=$arrIn[$value];
}
$arrIn=$arrOut;
}
Thanks,
Abdul Nissar