Solved

random link

Posted on 2007-03-21
4
195 Views
Last Modified: 2008-02-20
hello,
I would like to make something very simple for my site..
something like this

tutorial1 name link here
tutorial2 name link here
tutorial3 name link here

each time they refresh the same they change random places like this

tutorial2 name link here
tutorial3 name link here
tutorial1 name link here

can someone please help me do this?
0
Comment
Question by:Sabrin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 17

Expert Comment

by:HuyBD
ID: 18769241
first, you add all to array

$arr=array("link1","link2","link3");
then
$link=$arr[rand(0,3)];


HuyBD;
0
 
LVL 17

Accepted Solution

by:
HuyBD earned 500 total points
ID: 18769243
or

$arr=array("link1","link2","link3");
then
$link=$arr[rand(0,sizeof($arr))];

HuyBD;
0
 

Author Comment

by:Sabrin
ID: 18769246
ohh im not that good at php could you please make it easier for me?
0
 
LVL 17

Expert Comment

by:HuyBD
ID: 18769276
$arr=array("tutorial1 name link here","tutorial1 name link here","tutorial1 name link here");
$link=array_rand($arr,sizeof($arr));

for($i=0;$i<sizeof($link);$i++)
{
 echo $link[$i];
}

Hope this help

HuyBD;
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question