On Sat, Oct 1, 2011 at 10:59 AM, Ron Piggott <ron....@actsministries.org>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?

You can use variable variables [1] to access the variable by building its
name in a string:

    $name = 'trivia_answer_' . $correct_answer;
    echo $$name;


[1] http://php.net/manual/en/language.variables.variable.php

Reply via email to