I need to save many variables in text file and later retrieve any one random data from the text document.
For Example …i need to add 31231231 to the below text file
213123123
213123124
123412321
and i need to retrieve random value from above text file ..for example 213123124 from above text file
To write to the already existing file :
To get a random value from the file :
Edit: While retrieving the PHP_EOL is included so do this:
echo intval($file[$rand]);Edit: Seeing as
intval()returns themax_intfor numbers that exceed int specs, just usetrim();