<?php
class Question
{
public $text; // текст вопроса
public $points = 5; // число баллов, по умолчанию 5
public $answers; // варианты ответов
public $correctAnswer; // правильный ответ
}
$text = "Какая планета располагается четвертой по счету от Солнца?";
$points = 10;
'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;
}
function printQuestions($questions)
{
; // номер вопроса
}
$questions = createQuestions($text, $points, $answers, $correctAnswer);
$text2 = 'Какой город является столицей Великобритании?';
$points2 = 6;
'a' => 'Париж',
'b' => 'Москва',
'c' => 'Нью-Йорк',
'd' => 'Лондон'
);
$correctAnswer2 = 'd';
$questions = createQuestions($text2, $points2, $answers2, $correctAnswer2);
$print = printQuestions($questions);
PD9waHAKCm1iX2ludGVybmFsX2VuY29kaW5nKCJVVEYtOCIpOwoKY2xhc3MgUXVlc3Rpb24KewogICAgcHVibGljICR0ZXh0OyAvLyDRgtC10LrRgdGCINCy0L7Qv9GA0L7RgdCwCiAgICBwdWJsaWMgJHBvaW50cyA9IDU7IC8vINGH0LjRgdC70L4g0LHQsNC70LvQvtCyLCDQv9C+INGD0LzQvtC70YfQsNC90LjRjiA1CiAgICBwdWJsaWMgJGFuc3dlcnM7IC8vINCy0LDRgNC40LDQvdGC0Ysg0L7RgtCy0LXRgtC+0LIKICAgIHB1YmxpYyAkY29ycmVjdEFuc3dlcjsgLy8g0L/RgNCw0LLQuNC70YzQvdGL0Lkg0L7RgtCy0LXRggp9CiR0ZXh0ICAgICAgICAgID0gItCa0LDQutCw0Y8g0L/Qu9Cw0L3QtdGC0LAg0YDQsNGB0L/QvtC70LDQs9Cw0LXRgtGB0Y8g0YfQtdGC0LLQtdGA0YLQvtC5INC/0L4g0YHRh9C10YLRgyDQvtGCINCh0L7Qu9C90YbQsD8iOwokcG9pbnRzIC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