DEV Community

Discussion on: Daily Challenge #159 - Isogram

Collapse
 
maymeow profile image
May Meow • Edited

In php it can be done like this:

function is_isogram($str) {
    $str = strtolower($str);
    $maxRepeatingCount = 1;

    foreach (count_chars($str, 1) as $char => $value) {
        if ($value > $maxRepeatingCount) $maxRepeatingCount = $value;
     }

     if ($maxRepeatingCount == 1) return true;

     return false;
}