function multichoice_get_number_of_corrects in Quiz 6.2
Same name and namespace in other branches
- 5.2 multichoice.module \multichoice_get_number_of_corrects()
- 6.6 question_types/multichoice/multichoice.module \multichoice_get_number_of_corrects()
- 6.3 question_types/multichoice/multichoice.module \multichoice_get_number_of_corrects()
- 6.5 question_types/multichoice/multichoice.module \multichoice_get_number_of_corrects()
Get the number of correct answers in an array of multichoice answers.
Parameters
$answers: Array of multichoice answers.
Return value
$corrects The number of correct answers found in that array. Returns 0 if none found.
2 calls to multichoice_get_number_of_corrects()
- multichoice_insert in ./
multichoice.module - Implementation of hook_insert().
- multichoice_update in ./
multichoice.module - Implementation of hook_update().
File
- ./
multichoice.module, line 397 - Multiple choice question type for the Quiz module.
Code
function multichoice_get_number_of_corrects($answers) {
$corrects = 0;
if (is_array($answers)) {
foreach ($answers as $answer) {
$corrects += $answer['correct'];
}
}
return $corrects;
}