I searched, but the other threads don't answer my question, or I am just too stupid to see it.
$Questions = array(
1 => array(
'Question' => 'Second question',
'Answers' => array(
'A' => 'First answer of Second question',
'B' => 'Second answer Second question',
'C' => 'Third answer Second question'
),
'CorrectAnswer' => 'C'
)
);
How do I echo the value of 'CorrectAnswer'? Actually, I mean the value of 'C' (In this case, it would be "Third answer Second question"). $Value['CorrectAnswer'] gives me "C". But I can't just echo 'C', because in each array the correct answer is different. I am sure it's something really simple, but it escapes me. Sorry if I am not explaining it properly. This is the other piece of code:
foreach ($Questions as $QuestionNo => $Value)
{
if ($Answers[$QuestionNo] != $Value['CorrectAnswer'])
{
echo 'Your answer: <span style="color: red;">'.$Value['Answers'][$Answers[$QuestionNo]].'</span><br />
Correct answer: <span style="color: green;">'.$Value['CorrectAnswer'].'</span>';
}
}