How to sort an associative array by key in PHP?

Posted by Prem Tiwari | Updated on

In this example you will learn, how to sort an associative array by key in PHP. The PHP ksort() and krsort() functions can be used for sorting an array by key. The following section will show you how these functions basically work.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers