<?php
class Question
{
public $text; // текст вопроса
public $points = 5; // число баллов, по умолчанию 5
public $answers; // варианты ответов
public $correctAnswer; // правильный ответ
}
function createQuestions($text, $points, $answers, $correctAnswer, $arrayKey)
{
{
$q = new Question;
$q->text = $text;
$q->points = $points;
$q->answers = $answers;
$q->correctAnswer = $correctAnswer;
$questions[$arrayKey] = $q;
}
return $questions;
}
$answers = array("Йогурт", "Крем для лица", "Пища", "Ни одно из вышеуказанного");
$purr = createQuestions("Что придумали доисторические люди?", 5, $answers, 3, 0);
?>
PD9waHAKCmNsYXNzIFF1ZXN0aW9uCnsKICAgIHB1YmxpYyAkdGV4dDsgICAgICAgICAgIC8vINGC0LXQutGB0YIg0LLQvtC/0YDQvtGB0LAKICAgIHB1YmxpYyAkcG9pbnRzID0gNTsgICAgIC8vINGH0LjRgdC70L4g0LHQsNC70LvQvtCyLCDQv9C+INGD0LzQvtC70YfQsNC90LjRjiA1CiAgICBwdWJsaWMgJGFuc3dlcnM7ICAgICAgICAvLyDQstCw0YDQuNCw0L3RgtGLINC+0YLQstC10YLQvtCyCiAgICBwdWJsaWMgJGNvcnJlY3RBbnN3ZXI7ICAvLyDQv9GA0LDQstC40LvRjNC90YvQuSDQvtGC0LLQtdGCCn0KCmZ1bmN0aW9uIGNyZWF0ZVF1ZXN0aW9ucygkdGV4dCwgJHBvaW50cywgJGFuc3dlcnMsICRjb3JyZWN0QW5zd2VyLCAkYXJyYXlLZXkpCnsKICAgICRxdWVzdGlvbnMgPSBhcnJheSgpOwoKCWlmKGlzX2FycmF5KCRhbnN3ZXJzKSkKCXsKCQkkcSA9IG5ldyBRdWVzdGlvbjsKCQkkcS0+dGV4dCA9ICR0ZXh0OwoJCSRxLT5wb2ludHMgPSAkcG9pbnRzOwoJCSRxLT5hbnN3ZXJzID0gJGFuc3dlcnM7CgkJJHEtPmNvcnJlY3RBbnN3ZXIgPSAkY29ycmVjdEFuc3dlcjsKCQkkcXVlc3Rpb25zWyRhcnJheUtleV0gPSAkcTsK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