You Are Here: Home »   Code Tuesday January 6th 2009

Code Library - php

Random Link - (1106 views)


<?

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

//set the text links
$text = array("Google" ,"Hotmail" ,"Netcode");
        
srand(time());

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

?>