-
-
Save commix/1287276 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) { | |
return preg_match("/^[A-Z][a-zA-Z '&-]*[A-Za-z]$/", $name); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I just update this function to work with accented characters: https://gist.github.com/almino/eb4bd752b0ca580d9d6c