note 86574 modified in function.natsort by danbrown
| From: | danbrown@php.net | Date: | Fri, 24 Oct 2008 13:51:29 +0000 |
| Subject: | note 86574 modified in function.natsort by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-145694@lists.php.net to get a copy of this message | ||
A crude but simple way to implement knatsort:
<?php
$temp = array_flip( $unsorted_array );
natsort( $temp );
$sorted_array = array_flip( $temp );
?>
Flip the keys<=>values, natsort, then flip back. Done.
--was--
A crude but simple way to implement knatsort:
$temp = array_flip( $unsorted_array );
natsort( $temp );
$sorted_array = array_flip( $temp );
Flip the keys<=>values, natsort, then flip back. Done.
http://php.net/manual/en/function.natsort.php