Skip to content

Instantly share code, notes, and snippets.

@ytkhs
Created February 19, 2015 15:21
Show Gist options
  • Select an option

  • Save ytkhs/91dade32014289a912a0 to your computer and use it in GitHub Desktop.

Select an option

Save ytkhs/91dade32014289a912a0 to your computer and use it in GitHub Desktop.
文字列中に同じものがないかどうか調べる(半角英数)
<?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