$test_one = '1 23465';if(preg_match('#[^0-9\s]#',$test_one)){ $result = 'Ahah! Found an evil character.';}else{ $result = 'Only Digits and Spaces here!';}echo $result;
$test_one = '1 23465';if(digitsOnly($test_one)){ $result = 'Ahah! Found an evil character.';}else{ $result = 'Only Digits and Spaces here!';}echo $result;function digitsOnly($target){ return preg_match('#[^0-9\s]#', $target);}