Created
February 19, 2015 15:21
-
-
Save ytkhs/91dade32014289a912a0 to your computer and use it in GitHub Desktop.
文字列中に同じものがないかどうか調べる(半角英数)
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
| <?php | |
| function isUniqueChars($str) { | |
| return strlen($str) === count(array_unique(str_split($str))); | |
| } | |
| var_dump(isUniqueChars('abc')); | |
| var_dump(isUniqueChars('aaa')); | |
| var_dump(isUniqueChars('12345678901')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment