You are here

function question_get_id_from_name_prefix in Quiz 6.5

Same name and namespace in other branches
  1. 6.6 includes/moodle/lib/questionlib.php \question_get_id_from_name_prefix()

Extract question id from the prefix of form element names

Parameters

string $name The name that contains a prefix that was: constructed with {@link question_make_name_prefix()}

Return value

integer The question id

1 call to question_get_id_from_name_prefix()
question_extract_responses in includes/moodle/lib/questionlib.php
Extracts responses from submitted form

File

includes/moodle/lib/questionlib.php, line 1632

Code

function question_get_id_from_name_prefix($name) {
  if (!preg_match('/^resp([0-9]+)_/', $name, $matches)) {
    return false;
  }
  return (int) $matches[1];
}