PHP sorting arrays numerically by key value descending

前端 未结 3 1645
执念已碎
执念已碎 2021-01-11 14:15

Is there an option in PHP to sort an array by key value descending?

I am aware that you can sort key values with ksort

相关标签:
3条回答
  • 2021-01-11 14:53

    Yes, the krsort

    $fruits = array("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
    krsort($fruits);
    
    0 讨论(0)
  • 2021-01-11 15:00

    I believe krsort() is what you're looking for.

    0 讨论(0)
  • 2021-01-11 15:14

    http://www.php.net/manual/en/function.krsort.php krsort?

    0 讨论(0)
提交回复
热议问题