<?php
class Question
{
public $text; // текст вопроса
public $points = 5; // число баллов, по умолчанию 5
public $answers; // варианты ответов
public $correctAnswer; // правильный ответ
}
$text = "Какая планета располагается четвертой по счету от Солнца?";
$points = 10;
$answers = array('a' => 'Венера', 'b' => 'Марс', 'c' => 'Юпитер', 'd' => 'Меркурий'); $correctAnswer = 'b';
function createQuestions($text, $points, $answers, $correctAnswer)
{
$q = new Question;
$q->text = $text;
$q->points = $points;
$q->answers = $answers;
$q->correctAnswer = $correctAnswer;
$questions[] = $q;
return $questions;
}
$questions = createQuestions($text, $points, $answers, $correctAnswer);
PD9waHAKCm1iX2ludGVybmFsX2VuY29kaW5nKCJVVEYtOCIpOwoKY2xhc3MgUXVlc3Rpb24KewogICAgcHVibGljICR0ZXh0OyAgICAgICAgICAgLy8g0YLQtdC60YHRgiDQstC+0L/RgNC+0YHQsAogICAgcHVibGljICRwb2ludHMgPSA1OyAgICAgLy8g0YfQuNGB0LvQviDQsdCw0LvQu9C+0LIsINC/0L4g0YPQvNC+0LvRh9Cw0L3QuNGOIDUKICAgIHB1YmxpYyAkYW5zd2VyczsgICAgICAgIC8vINCy0LDRgNC40LDQvdGC0Ysg0L7RgtCy0LXRgtC+0LIKICAgIHB1YmxpYyAkY29ycmVjdEFuc3dlcjsgIC8vINC/0YDQsNCy0LjQu9GM0L3Ri9C5INC+0YLQstC10YIKfQokdGV4dCA9ICLQmtCw0LrQsNGPINC/0LvQsNC90LXRgtCwINGA0LDRgdC/0L7Qu9Cw0LPQsNC10YLRgdGPINGH0LXRgtCy0LXRgNGC0L7QuSDQv9C+INGB0YfQtdGC0YMg0L7RgiDQodC+0LvQvdGG0LA/IjsKJHBvaW50cyA9IDEwOwokYW5zd2VycyA9IGFycmF5KCdhJyA9PiAn0JLQtdC90LXRgNCwJywgJ2InID0+ICfQnNCw0YDRgScsICdjJyA9PiAn0K7Qv9C40YLQtdGAJywgJ2QnID0+ICfQnNC10YDQutGD0YDQuNC5Jyk7CiRjb3JyZWN0QW5z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