PHP Tutorial : Random link rotator

Hi,

In this php tutorial you will learn how to build a random link rotator. Basically, we’ll build a php array with the links needed to rotate and then we’ll print to user the link randomly.

<?php
$links = array("link 1", "link 2", "link 3");
$max = sizeof($links);
$rand = rand(0, $max);
print $links[$rand];
?>
This entry was posted in Usefull PHP and tagged , , , , . Bookmark the permalink.

4 Responses to PHP Tutorial : Random link rotator

  1. Freeware Files says:

    i want to know how to rotate my ads, i am using 2 different ad networks, i want to know hot to do that.

  2. admin says:

    Well rent my php services or think! You get no freebies here!

  3. yoowis says:

    Hi…
    That’s very useful script. I’ve use it for rotate link to show different homepage every loaded. Very nice..

    thanks :)

  4. admin says:

    Very happy to hear, thank you for appreciating my great work!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>