I\'m working on a function that gets a string like this:
identifier 20 j. - cat: text text text aaaa ffffdd ..... cccc 60\' - text, 2008
and
You can use a regular expression for this:
$matches = array();
preg_match('/identifier\s*(\d+)/', $string, $matches);
var_dump($matches);
\s*
is whitespace. (\d+)
matches a number.
You can wrap it in a function:
function matchIdentifier($string) {
$matches = array();
if (!preg_match('/identifier\s*(\d+)/', $string, $matches)) {
return null;
}
return $matches[1];
}