Page 1 of 1

Random file chooser

Posted: Sun Mar 13, 2005 10:16 am
by mscorelle
I'm looking for a way to randomly choose php files. I have php files set up like text ads, but I only want to display one at a time randomly. I haven't been able find a code that will do it.

Posted: Sun Mar 13, 2005 10:20 am
by feyd
  1. Figure out how to get a list of files. Difficulty: easy.
  2. Store the list of files in an array. Difficulty: easy.
  3. Use one of the random integer functions to choose one of those files: Difficulty: easy.
We've talked about #1 many times (search for opendir). The other two can be found in the php.net documentation quite easily.

Posted: Sun Mar 13, 2005 10:32 am
by mscorelle
Thank you