Random Banner

April 13th, 2009
| Tags: random banner
Tutorial Description:
Tutorial Description:
Learn how to display a banner/button randomly.
Display banner/buttons randomly with this short code.
<?php
// Define file names, you can add as many as you like.
$banner = array(1 => 'img1.gif', 'img2.gif', 'img3.gif');
// Lets grab a random one.
$random = rand(1, count($banner));
// Print image.
echo '<img src="' .$banner[$random]. '" border="0" alt="Random Image" />';
?>
To add more images to the set, just add them in the array.
Leave a comment
| Trackback

