<?php

class Question
{
    public $text;           // текст вопроса
    public $points = 5;     // число баллов, по умолчанию 5
    public $answers;        // варианты ответов
    public $correctAnswer;  // правильный ответ
}

function createQuestions($text, $points, $answers, $correctAnswer, $arrayKey)
{
    $questions = array();

	if(is_array($answers))
	{
		$q = new Question;
		$q->text = $text;
		$q->points = $points;
		$q->answers = $answers;
		$q->correctAnswer = $correctAnswer;
		$questions[$arrayKey] = $q;
	}
    return $questions;
}
$answers = array("Йогурт", "Крем для лица", "Пища", "Ни одно из вышеуказанного");

$purr = createQuestions("Что придумали доисторические люди?", 5, $answers, 3, 0);

var_dump($purr);

?>