You are here

function _quiz_get_id_from_string in Quiz 7

Same name and namespace in other branches
  1. 8.4 quiz.admin.inc \_quiz_get_id_from_string()
  2. 6.4 quiz.admin.inc \_quiz_get_id_from_string()
  3. 7.6 quiz.admin.inc \_quiz_get_id_from_string()
  4. 7.4 quiz.admin.inc \_quiz_get_id_from_string()
  5. 7.5 quiz.admin.inc \_quiz_get_id_from_string()

Searches for an id in the end of a string.

Id should be written like "(id:23)"

Parameters

string $string: The string where we will search for an id

Return value

int The matched integer

1 call to _quiz_get_id_from_string()
quiz_categorized_form_validate in ./quiz.admin.inc
Validate the categorized form

File

./quiz.admin.inc, line 749
Administrator interface for Quiz module.

Code

function _quiz_get_id_from_string($string) {
  $matches = array();
  preg_match('/\\(id:(\\d+)\\)$/', $string, $matches);
  return isset($matches[1]) ? (int) $matches[1] : FALSE;
}