I'm trying to validate a Spanish phone number. I have a regular expression declared:
$telefono_regex = '/^(6|7|8|9)[0-9]{8}$/';
And I check the number:
if (!preg_match($telefono_regex, $telefono)){
array_push($errores, 'telefono');
}
Why does this always return false? I have checked in https://regex101.com/ and found match with the same numbers.