<?php
function get_numerics ($str) {
preg_match_all('/\d+/', $str, $matches);
return $matches[0];
}
$one = 'one two 4 three (5 four five)';
$two = 'one two 2 three';
$three = 'one two 12 three (3 four)';
$four = 'one two 3 three (13 four five)';
print_r(get_numerics($one));
print_r(get_numerics($two));
print_r(get_numerics($three));
print_r(get_numerics($four));
?>