note 63798 deleted from function.natsort by nlopess
| From: | nlopess@php.net | Date: | Fri, 31 Mar 2006 09:42:51 +0000 |
| Subject: | note 63798 deleted from function.natsort by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-107063@lists.php.net to get a copy of this message | ||
Note Submitter: Juokelis
----
Hello, I haven't founf function to sort keys in "natural order", so may be someone
will find this useful:
<?
function natksort ( $arrayIn ) {
$arrayOut = array ();
$arrayTemp = array ();
$arrayTemp = array_keys( $arrayIn );
natsort ( $arrayTemp );
foreach ( $arrayTemp as $key ) {
$arrayOut[$key] = $arrayIn[$key];
}
return $arrayOut;
}
?>