|
Posted by Noodle on 07/23/06 05:09
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
Also, here is what was wrong with your code...
<?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(0,2); //The range should be from 0, 2
not 1, 3
//Pring Random Quote
echo $quote[$rndNum]; //Left the $ off rndNum
?>
Navigation:
[Reply to this message]
|