brmcdani Posted May 19, 2010 Share Posted May 19, 2010 I have a simple image array that is being called to rotate images. I need to assign some ahref values to the images. How would I go about this? I would guess add the url to the array. Any ideas would be appreciated here is my code: <?php function randomImage ( $array ) { $total = count($array); $call = rand(0,$total-1); return $array[$call]; } $my_images = array ( "banners/1.jpg", "banners/2.jpg", "banners/3.jpg", "banners/4.jpg", "banners/5.jpg", "banners/6.jpg", ); echo '<img src="'.randomImage($my_images).'"; alt="Random Image" />'; ?> Link to comment https://forums.phpfreaks.com/topic/202295-image-rotation/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.