You Are Here: Home »   Code

Code Library - php

Random Image - (1,743 views)


<?php

//set the urls
$urls = array("http://google.com" ,"http://hotmail.com" ,"http://netcode.net" );

//set the text links
$text = array("Images/google.gif" ,"Images/hotmail.gif" ,"Images/netcode.gif");
        
srand(time());

//set the number in (rand()%3); for however many links there are
        
$random = (rand()%3);
echo (
"<a href = \"$urls[$random]\"><img border='0' src='$text[$random]'></a>");

?>