i re-wrote the same function to include support for decimal values,
and used normal string accessing method, ie [], it look like,
function str_get_nums($str)
{
$new_str = '';
for ($i = 0; $i < strlen($str); $i++)
if (ctype_digit($str[$i]) || $str[$i]==".")
$new_str .= $str[$i];
return $new_str;
}
and it works.