Page 1 of 1

How to select random files...

Posted: Sat Jan 31, 2004 11:14 am
by Anonymous2
I need to know how to select a random file.

1.php
This file is the file that includes a random file when opened.
Either rand1.php rand2.php or rand3.php

How would I do this?

Something like using an include except it's randomised.

Posted: Sat Jan 31, 2004 11:16 am
by markl999

Code: Select all

//without the usual validation/checking you'de want to do
$rand = rand(1, 3);
$incfile = 'rand'.$rand.'.php';
require_once $incfile;