I have a function: Function returns numbers from string line.
function get_numerics ($str) {
preg_match_all('/\d+/', $str, $matches);
return $matches[0];
}
And I need to get numbers to an array in my php file. How to do that?
$counter = $user_count[$sk]; //$user_count[$sk] gives me a string line
//$user_count[$sk] is "15,16,18,19,18,17" - And i need those numbers seperated to an array
$skarray[] = get_numerics($counter); //Something is wrong?
Explode could work, but $user_count[$sk] line could be "15, 16, 19, 14,16"; ie it may or may not contain spaces.