Jump to content

[SOLVED] Reading a Random Line From a Text File


MrGaz

Recommended Posts

Hi :)

 

I'm new to PHP and so am unfamiliar about all the pros/cons of the many different methods of reading files.

 

I'm looking for a function that will allow me to quickly read a single line at random from a very large text file.

 

The text file will just be a very long list of words, with each word on a new line, I want to be able to pick one of these words at random.  The text file will also be local on my server and not a url.

 

Anyone able to help with the best solution?

 

Cheers

 

Gaz

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.