Posted By

akt on 05/02/12


Tagged

sort array field column multidimensional


Versions (?)

array sort field


 / Published in: PHP
 

sort a multidimensional array by field

  1. function array_field_sort(&$array, $field) {
  2. $code = "return strnatcmp(\$a['$field'], \$b['$field']);";
  3. $compare = create_function('$a,$b', $code);
  4. uasort($array,$compare);
  5. }

Report this snippet  

You need to login to post a comment.