1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| function is_a_prenom_nom($arg_str)
{
if(preg_match('/[^[:alpha:]\' -]/u',$arg_str)) return false;
return true;
}
function is_a_prenom_nom_unicode($arg_str)
{
if(preg_match('/[^[\P{L}\' -]/u',$arg_str)) return false;
return true;
}
if(is_a_prenom_nom('jean-luc étienne')) echo ' is_a_prenom_nom : accepté ';
else echo ' is_a_prenom_nom : refusé ';
echo '-';
if(is_a_prenom_nom_unicode('jean-luc étienne')) echo ' is_a_prenom_nom_unicode : accepté ';
else echo ' is_a_prenom_nom_unicode : refusé '; |
Partager