function check_characters($str) {
for ($i = 0; $i < strlen($str); $i++) {
if (!(ord($str[$i]) >= 32 && ord($str[$i]) <= 57)) {
return false;
}
}
return true;
}
$str = "(+)!-127.847 +$84925 %";
echo check_characters($str) ? "yes" : "no";
/*
run:
yes
*/