Sort multidimensional array by multiple keys

前端 未结 7 612
挽巷
挽巷 2020-11-22 10:05

I\'m trying to sort a multidimensional array by multiple keys, and I have no idea where to start. I looked at uasort, but wasn\'t quite sure how to write a function for what

7条回答
  •  粉色の甜心
    2020-11-22 10:30

    if you want to sort multi dimentional array

    first array is :

    $results['total_quote_sales_person_wise']['quote_po'];
    

    second one is :

    $results['total_quote_sales_person_wise']['quote_count'];
    

    this both multidimentional array you want to sort descending order at one time then use this code :

    array_multisort($results['total_quote_sales_person_wise']['quote_po'],SORT_DESC, $results['total_quote_sales_person_wise']['quote_count'],SORT_DESC);
    

提交回复
热议问题