I'm trying to set some variables and always end up getting no value at all for the keys. PHP throws undefined index warnings at the following lines in my code:

$question['answer'.($i+1)]['answer'] = $temp_array["answer".$random_clip];
$question['answer'.($i+1)]['answer_id'] = $answer_mappings[$i];

Is there some other syntax for this? I've searched all over this forum and am coming up with nothing. The strange thing is, when I run this in my PhpED debugger, all the values get set, but outside the debugger, the values are null.

    nevermind.

    I discovered the problem was that I was shuffling a source array the wrong way in a preceeding part of the program. Instead of saying

    shuffle($array);

    I was saying

    $array=shuffle($array);

    which was screwing up the source array and feeding incorrect data to my variables below it. So let that be a lesson to whoever. Don't use shuffle() the wrong way. Some would say, don't use it at all, but it's okay if you don't have to have a great randomizer for your array. I just use it to shuffle multiple choice quiz answers so users can't memorize quiz questions by knowing the order the answers appear in. In this case, shuffle is fine for me so please save the flames about using shuffle().😃

      :o You know... you shouldn't --

      oh. Never mind. 😃

        Write a Reply...