You want to randomly reorder all lines in a file. You have a file of funny quotes, for example, and you want to pick out one at random.
Read all the lines in the file into an array with file( ) , and then shuffle the elements of the array, as in Example 23-27.
Randomizing all lines in a file
The shuffle( ) function randomly reorders the array elements, so after shuffling, you can pick out $lines as a quote to display.
23.9.4. See Also
Recipe 4.20 for shuffle( ); documentation on shuffle( ) at http://www.php.net/shuffle.