-
-
Save almino/eb4bd752b0ca580d9d6c to your computer and use it in GitHub Desktop.
PHP: Validate - Human Name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Validate a Human Name | |
* | |
* @param $name | |
* A name as a string. | |
* @return | |
* TRUE or FALSE if name is a valid human name. | |
*/ | |
function valid_human_name($name) { | |
# Matches names like "Ítalo", "Édith" | |
return (bool) preg_match("/^\p{Lu}[\p{L} '&-]*[\p{L}]$/u", $name); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What about asian names? 김민경 for example