Posted By

rccc on 02/20/10


Tagged

php array


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

redstorm
dantreacy
tux-world


Sorting a Multi-Dimensional Array with PHP


 / Published in: PHP
 

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

  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. }

Report this snippet  

You need to login to post a comment.