Posted by boclair on 07/23/06 05:29
Noodle wrote:
> orbstra@gmail.com wrote:
>> <?php
>>
>> //Variables
>> //Quotes
>> $quote[0] = "'If at first you don't succeed; call it version 1.0' -
>> T-Shirt";
>> $quote[1] = "Microsoft: 'You`ve got questions. We've got dancing
>> paperclips.' - Unknown";
>> $quote[2] = "I would love to change the world, but they won't give
>> me the source code!' - Unknown";
>> //Random Number
>> $rndNum = rand(1,3);
>> //Pring Random Quote
>> echo $quote[rndNum];
>> ?>
>>
>>
>> Why does this not do anything!? Please help asap!
>>
>> -vas
>
> This will produce a random quote from an array...
>
> <?php
> //Where $quote is a string array
> echo $quote[array_rand($quote)];
> ?>
Wrong idea. Not integers.
Try shuffle($quotes);
echo $quote[0];
Louise
Navigation:
[Reply to this message]
|