<?php

mb_internal_encoding("UTF-8");

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)
{
    $questions        = array();
    $q                = new Question;
    $q->text          = $text;
    $q->points        = $points;
    $q->answers       = $answers;
    $q->correctAnswer = $correctAnswer;
    $questions[]      = $q;
    return $questions;
    
}
function printQuestions($questions)
{
; // номер вопроса
print_r($questions);

    
    
}

    

$questions = createQuestions($text, $points, $answers, $correctAnswer);
var_dump($questions);

$text2          = 'Какой город является столицей Великобритании?';
$points2        = 6;
$answers2       = array(
    'a' => 'Париж',
    'b' => 'Москва',
    'c' => 'Нью-Йорк',
    'd' => 'Лондон'
);
$correctAnswer2 = 'd';
$questions     = createQuestions($text2, $points2, $answers2, $correctAnswer2);
var_dump($questions);
$print = printQuestions($questions);
var_dump($print);