Sorting a Multi-Dimensional Array with PHP


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



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

URL: http://firsttube.com/read/sorting-a-multi-dimensional-array-with-php/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.