Skip to content

Instantly share code, notes, and snippets.

@commix
Forked from mpezzi/gist:1287269
Created October 14, 2011 14:30
Show Gist options
  • Save commix/1287276 to your computer and use it in GitHub Desktop.
Save commix/1287276 to your computer and use it in GitHub Desktop.
PHP: Validate - Human Name
/**
* 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);
}
@almino
Copy link

almino commented Mar 4, 2016

I just update this function to work with accented characters: https://gist.github.com/almino/eb4bd752b0ca580d9d6c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment