rand() function that changes for each use
Posted: Wed Feb 25, 2009 5:49 am
I want to have the possibility to show a few randomely choosen pictures from a folder, and thought I'd use rand() to pick them out. However, I realised that if I wrote
I'd have the same picture written three times, as $pic doesn't change between these, only once - when the script loads. Is there a function or another way to have three DIFFERENT, randomely choosen pictures?
Thanks on forehand.
Code: Select all
$pic = rand(0,15);
echo "<img src='{$pic}.png'>
<img src='{$pic}.png'>
<img src='{$pic}.png'>";Thanks on forehand.