Re: Variable question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01 Oct 2011 at 18:59, Ron Piggott <ron.php@xxxxxxxxxxxxxxxxxx> wrote: 

> If $correct_answer has a value of 3 what is the correct syntax needed to use
> echo to display the value of $trivia_answer_3?
>
> I know this is incorrect, but along the lines of what I am wanting to do:
>
> echo $trivia_answer_$correct_answer;
>
> $trivia_answer_1 = “1,000”;
> $trivia_answer_2 = “1,250”;
> $trivia_answer_3 = “2,500”;
> $trivia_answer_4 = “5,000”;

Not completely obvious to me what you're trying to do but I assume its:

echo '\$trivia_answer_' . $correct_answer . " = \"" . $somevalue . "\";"; 

--
Cheers  --  Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux