Re: a quick question..
| From: | Miles Thompson | Date: | Sun, 27 Jan 2002 19:15:05 +0000 |
| Subject: | Re: a quick question.. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-82303@lists.php.net to get a copy of this message | ||
Try this:
Store variables in an array, say $msg_array. (For those of Hungarian preference, $arrMessages.)
$index = rand (0, $n)
echo $msg_array[ $index ]
Now this will require a bit of messing about, seeding the randomizer, etc., but you get the idea.
Miles Thompson
On Sunday 27 January 2002 03:00 pm, Tauntz wrote:
> If I have n variables:
> $nr1 = "some text";
> $nr2 = "some other text"
> $nr3....
> ....
> and I want to print the text "randomly" (like if I enter the page.. it
> displays $nr1... next time it displays $nr 5.. etc) how can I achieve it ?
>
> tauntz@hot.ee