You are here: Re: 11 line random quote system « PHP Programming Language « IT news, forums, messages
Re: 11 line random quote system

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация