function validatePhoneNumber($phoneNumber) {
$regex = '/^\+?[0-9]{1,3}\s?\(?[0-9]{3}\)?[-\s]?[0-9]{3}[-\s]?[0-9]{4}$/';
if (preg_match($regex, $phoneNumber)) {
return true;
} else {
return false;
}
}
//example
$result = validatePhoneNumber('+1 (555) 555-5555');
//output
echo $result; //true
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)