Answers for "php array sorting multidimentiaonal"

PHP
2

php sort multidimensional array

array_multisort(array_map(function($element) {
      return $element['order'];
  }, $array), SORT_ASC, $array);

print_r($array);
Posted by: Guest on June-09-2020
1

php sort multidimensional array by value

function sortByOrder($a, $b) {
    return $a['order'] - $b['order'];
}

usort($myArray, 'sortByOrder');
Posted by: Guest on October-15-2020

Browse Popular Code Answers by Language