Random pictures - not twice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there!

I have created a script the generates random pictures...

<?php
//Random pictures
//
$pictures[0] = "bil1.gif";
$pictures[1] = "bil2.gif";
$pictures[2] = "bil3.gif";
$pictures[3] = "bil4.gif";


for ($i=0;$i<3;$i++) {
 $r = rand(0,3);
?>
<p>&nbsp;&nbsp;<img src="<?php echo $pictures[$r];?>"></p>
<?php

}
?>


With this above script the same picture can be shown twice. Is there any smart way of avoiding this without having to rely on cookies/sessionids?

Best regards
/Gustav Wiberg
Stammis Internet - http://www.stammis.com/ - pedigrees on the net

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux