Created
July 13, 2015 18:30
-
-
Save webkader/15e930ba8c720be37e60 to your computer and use it in GitHub Desktop.
Check if a string is a valid string
This file contains 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
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