Function __global->score_quiz

Definitions

sources/quiz.php

  • Score a particular quiz entry.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$entry_id AUTO_LINK No No required parameter N/A N/A Entry ID
$quiz_id ?AUTO_LINK No No Null N/A N/A Quiz ID (null: look up from entry ID)
$quiz ?array No No Null N/A N/A Quiz row (null: look up from entry ID)
$questions ?array No No Null N/A N/A Question rows (null: look up from entry ID)
$reveal_all boolean No No False N/A N/A Whether to show answers, regardless of whether the quiz is set to do so

Returns

  • A tuple of quiz result details
  • Type: array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Score a particular quiz entry.
 *
 * @param  AUTO_LINK $entry_id Entry ID
 * @param  ?AUTO_LINK $quiz_id Quiz ID (null: look up from entry ID)
 * @param  ?array $quiz Quiz row (null: look up from entry ID)
 * @param  ?array $questions Question rows (null: look up from entry ID)
 * @param  boolean $reveal_all Whether to show answers, regardless of whether the quiz is set to do so
 * @return array A tuple of quiz result details
 */

function score_quiz(int $entry_id, ?int $quiz_id = null, ?array $quiz = null, ?array $questions = null, bool $reveal_all = false) : array