Skip to content

Instantly share code, notes, and snippets.

@webkader
Created July 13, 2015 18:30
Show Gist options
  • Save webkader/15e930ba8c720be37e60 to your computer and use it in GitHub Desktop.
Save webkader/15e930ba8c720be37e60 to your computer and use it in GitHub Desktop.
Check if a string is a valid string
function isValidString($string)
{
if (empty($string)) {
return false;
}
if (preg_match("/[\||\'|\<|\>|\[|\]|\"|\!|\?|\$|\@|\/|\\\|\&\~\*\{\+]/", $string)) {
return false;
} else {
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment