Array subval sort


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function subval_sort($a,$subkey)
  2. {
  3. foreach($a as $k=>$v)
  4. {
  5. $b[$k] = strtolower($v[$subkey]);
  6. }
  7. arsort($b);
  8. foreach($b as $key=>$val)
  9. {
  10. $c[] = $a[$key];
  11. }
  12. return $c;
  13. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.