ctype_digit but allow spaces
Moderator: General Moderators
ctype_digit but allow spaces
I want to validate some data - it has to be a phone number so only numbers, but I'd also like to allow spaces. can I use ctype_digit in combination with something?
good point, why didn't I think of that
. a simple
did the trick. I've yet to learn regex
Code: Select all
$number = str_replace(" ", "", $tel);
//then
ctype_digit($number):