I know that this works:
preg_match('/\d+/', '1234 Subject', $matches);
echo $matches[0]; // 1234
But I'm curious if there's a built-in function that just returns the first match, a la:
echo mysteryFunction('/\d+/', '1234 Subject'); // 1234
Without having to store the results in an array and having to then reference an array element separately?
If not, why not, is there a good reason?
Thanks