        <?php
        class Question
{
    public $text;           // текст вопроса
    public $points = 5;     // число баллов, по умолчанию 5
    public $answers;        // варианты ответов
    public $correctAnswer;  // правильный ответ
}
function createQuestions()
{
   
    $questions = [];
  $ans = [];
   
    $q = new Question;
    $q->text = "Какая планета располагается четвертой по счету от Солнца?";
        $q->answers =  array('a' => 'Венера', 'b' => 'Марс', 'c' => 'Юпитер', 'd' => 'Меркурий');
    $questions[] = $q;

   
    $q = new Question;
 $q->text = 'Какой город является столицей Великобритании?';
         $q->answers =  array('a' => 'Париж', 'b' => 'Москва', 'c' => 'Нью-Йорк', 'd' => 'Лондон');
           $questions[] = $q;
      $q = new Question;
 $q->text = 'Кто придумал теорию относительности?';
 $q->answers =  array('a' => 'Джон Леннон', 'b' => 'Джим Моррисон', 'c' => 'Альберт Эйнштейн', 'd' => 'Исаак Ньютон');
           $questions[] = $q;
   
           
           
           
         return $questions;
}



function printQuestions($questions)
{
    $number = 1; // номер вопроса

    foreach ($questions as $question) {
        echo "{$number}. {$question->text}\n\n";

        echo "Варианты ответов:\n";

        foreach ($question->answers as $letter => $answer) {
            echo "  {$letter}. {$answer}\n";
        }

        $number++; 
    }
}


        

$questions = createQuestions();
printQuestions($questions);




?>
 