PHP: Randomizing All Lines of a File – Shuffle Lines in a Text File
Of course, you will have to read in the file first, preferably in an array. To read a file in an array, you just need the file() function: $lines = file(‘quotes.txt’); Then, you shuffle the array with shuffle() function that randomizes all the items in the array thus shuffling the lines in the file quotes.txt: …
PHP: Randomizing All Lines of a File – Shuffle Lines in a Text File Read More »