my PHP validation regex not working and i don't understand why. My code returning: 'Failure'. I checked my regex pattern and it is valid: https://regex101.com/r/2Is2L5/2
Phone value is: +7 (555) 555–55–55
if(preg_match('/^\+?\d{1,3}\s*\(\d{3}\)\s*\d{3}[-–•\s]?\d{2}[-–•\s]?\d{2}$/', $_GET['userPhone'])) {
echo 'Success';
}
else{
echo 'Failure';
}
Please help!
•) ?var_dump($_GET['userPhone']);