Created
May 8, 2014 03:53
-
-
Save cethap/847ddde5387c4b5153a9 to your computer and use it in GitHub Desktop.
ShortPhpGist
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
if (strlen($text) == 0 XOR preg_match('/^./us', $text) == 1) { | |
// The string validates. | |
} | |
else { | |
// The string doesn't validate. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment