Any help would be greatly appreciated. I'm working on a quiz engine in PHP and I have everything working without problems save for the fact that I cannot an array to work for what I need it to work.
The array should store the answer's that the user inputs during the quiz.
$val_temp = explode("|",$val);
$answers += $val_temp[0];
if ($num == 0)
{$answernum = array();}
else
{$answernum[] = $val_temp[1];}
is my array coding, it should init the array when $num is 0, at the beginning, and each quiz question add the answer to the array $answernum. But it doesnt. Instead, the array is empty. If I put:
$val_temp = explode("|",$val);
$answers += $val_temp[0];
if ($num == 0)
{$answernum = array();}
else
{$answernum[$num] = $val_temp[1];}
only the last answer is stored into the array, and everything else is erased like the array is getting reinitialized. I don't see why that would be happening.
any help at all would be greatly appreciated, again.