Top of the page (before any HTML):
PHP Code:
<?php
function random_link() {
$links = array("teen link" => "http://link1.com", "mature babes" => "link2.com","horny sluts" => "link3.com");
shuffle($links); // randomize
list($linktext, $url) = each($links); // pull the first link on the list
echo "<a href='$url'>$linktext</a>"; // display it
}
?>
Then use <? random_link(); ?> in your HTML where ever you want the link displayed.
P.S. I'm not sure how random the shuffle() function is.
You can also create a random_link.php file, dump the code in there, then do an include where you want the link displayed:
<? include('path to file..../random_link.php'); ?>
Personally though, I would stick with JS, because with PHP you're adding a slight load on the server. Also, I'm sure you can use an external JS file and just call the function in your HTML. Only time I'd use PHP for something like this is if I was dealing with hundreds of links.