<?php 
// error_reporting(-1);
class Question
{
    public $text;           // текст вопроса
    public $points = 5;     // число баллов, по умолчанию 5
    public $answers;        // варианты ответов
    public $correctAnswer;  // правильный ответ
	
}
function createQuestions()
{
	$questions = [];
	
	$q = New Question;
	$q -> $text = 'Столица Россиюшки';
	$q -> $points = 1;
	$q -> $answers = array('a' => 'Париж', 'b' => 'Москва', 'c' => 'Нью-Йорк', 'd' => 'Лондон');
	$q -> $correctAnswer = 'b';
	
	$questions[] = $q;
	
	$q = New Question;
	$q -> $text = 'Ээх, как же хочется в...';
	$q -> $points = 1;
	$q -> $answers = array('a' => 'Россиюшку', 'b' => 'мамину квартиру', 'c' => 'Магадан', 'd' => 'ЮВА');
	$q -> $correctAnswer = 'd';
	
	$questions[] = $q;
	
	$q = New Question;
	$q -> $text = 'Наверное, мы преуспеем в чем?';
	$q -> $points = 1;
	$q -> $answers = array('a' => 'В прокрастинации', 'b' => 'В программировании', 'c' => 'В прокачивании эльфа 80 уровня', 'd' => 'Не придумал');
	$q -> $correctAnswer = 'd';
	
	$questions[] = $q;
	
	Return $questions;
}

function printQuestions($questions)
{
    $number = 1; 

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

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

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

        $number++; 
    }
}

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