Random link

This is a random link example, deine the urls and the titles for the links remember and change the  (rand()%3) if you have more than 3 links

<?php
$urls = array(“http://www.getphp.net” ,
“http://www.holed.net” ,
“http://cheats.gamedrop.net” );
$titles = array(“PHP site” ,
“Golf site” ,
“Cheats site”);
//generate a random number
srand(time());
$random = (rand()%3);
//display link
echo (“<a href = \”$urls[$random]\”>$titles[$random]</a>”);
?>

LEAVE A REPLY

Please enter your comment!
Please enter your name here

*