Re:Array_rand issue...
| From: | adi | Date: | Sat, 01 Jun 2002 01:40:03 +0000 |
| Subject: | Re:Array_rand issue... | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-19564@lists.php.net to get a copy of this message | ||
"Dave Carrera" <dave@davecarrera.com> menulis tgl 5/31/02 2:39:45 PM:
>
>Hi All
>
>I have a fuctioning array of about 20 items.
>What i would like to do is display 3 items from the array randomly and be
>able to place the output anywhere on the screen.
>
>I have looked at array rand and associated functions at php.net and are
>currently playing with the code to see if i can make it work but some
>guidence in this matter would be very much appreciated.
>
>Thank you in advance
perhaps you can use array_rand(), see manual. here's snip from manual
srand ((float) microtime() * 10000000);
$input = array ("Neo", "Morpheus", "Trinity", "Cypher",
"Tank");
$rand_keys = array_rand ($input, 2);
print $input[$rand_keys[0]]."\n";
print $input[$rand_keys[1]]."\n";
$internet = "indomie telor kornet";
_______________
adi.aroundbali.com