function create_runtime_question($question, $form) { $question = parent::create_runtime_question($question, $form); $question->options->answers = array(); foreach ($form->answers as $key => $answer) { $a->answer = trim($form->answer[$key]); $a->fraction = $form->fraction[$key]; //new $a->tolerance = $form->tolerance[$key]; $a->tolerancetype = $form->tolerancetype[$key]; $a->correctanswerlength = $form->correctanswerlength[$key]; $a->correctanswerformat = $form->correctanswerformat[$key]; $question->options->answers[] = clone $a; } return $question; }