Posted By

bitstream on 08/02/11


Tagged

natsort


Versions (?)

natural sort


 / Published in: PHP
 

natural sort array

  1. function knatsort(&$karr){
  2. $kkeyarr = array_keys($karr);
  3. natsort($kkeyarr);
  4. $ksortedarr = array();
  5. foreach($kkeyarr as $kcurrkey){
  6. $ksortedarr[$kcurrkey] = $karr[$kcurrkey];
  7. }
  8. $karr = $ksortedarr;
  9. return true;
  10. }

Report this snippet  

You need to login to post a comment.