How to randomize the order of an array in PHP?

Posted by Prem Tiwari | Updated on

In this example you will learn, how to randomize the order of an array in PHP You can use the PHP shuffle() function to randomly shuffle the order of the elements or values in an array. The shuffle() function returns FALSE on failure.

Let’s try out the following example to understand how this function basically works:


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