I have a web page that displays an image. I would like to randomize
which image it displays when the page loads. Every possible image will
be the same dimensions and file format. Each image will be named a
consecutive number begining with 1.
The code I am using is:
$number = rand(1, 10);
$file = $number . "." . "gif";
echo"<img src = 'random_images/$file'>";
I'm wondering if there is a way to count how many files are in the
random_images directory, so I can dynamically set the range of my
rand(). This way I can add images to the random_images directory
without having to increase the range in the php code.
Thanks!
Nick
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]