Hi, I have 3 images, fish-cartoon.png, fish-cartoon2.png and fish-cartoon3.png. All 3 of the images are at images/. They are all the same pixel size, and similar kb size, and i want them to randomize. How could i do this using PHP? It is for fitfishes.com ROb
rename first image i.e. fish-cartoon.png to fish-cartoon1.png use the function rand(1,3) http://www.php.net/rand and you've done it..
The problem is that i know no PHP code whatsoever, and i am unsure what to write, would this be correct? <?php echo rand() . "fish-cartoon.png"; echo rand() . "fish-cartoon2.png"; echo rand() . "fish-cartoon3.png"; ?> Code (markup): Rob
<?php $list = array('a.jpg','b.jpg','c.jpg'); shuffle($list); echo '<img src="images/'.$list[0].'" />'; ?> PHP: