protected function expandCharacterSets($spec)
    {
        $combined = '';
        if ($spec == self::EASY_TO_READ) {
            $spec |= self::CHAR_ALNUM;
        }
        foreach ($this->charArrays as $flag => $chars) {
            if ($flag == self::EASY_TO_READ) {
                // handle this later
                continue;
            }
            if (($spec & $flag) === $flag) {
                $combined .= $chars;
            }
        }
        if ($spec & self::EASY_TO_READ) {
            // remove ambiguous characters
            $combined = str_replace(str_split(self::AMBIGUOUS_CHARS), '', $combined);
        }

        return count_chars($combined, 3);
    }
protected function expandCharacterSets($spec)
    {
        $combined = '';
        if ($spec == self::EASY_TO_READ) {
            $spec |= self::CHAR_ALNUM;
        }
        foreach ($this->charArrays as $flag => $chars) {
            if ($flag == self::EASY_TO_READ) {
                // handle this later
                continue;
            }
            if (($spec & $flag) === $flag) {
                $combined .= $chars;
            }
        }
        if ($spec & self::EASY_TO_READ) {
            // remove ambiguous characters
            $combined = str_replace(str_split(self::AMBIGUOUS_CHARS), '', $combined);
        }

        return count_chars($combined, 3);
    }
protected function expandCharacterSets ( $ spec ) { $ combined = '' ; if ( $ spec == self :: EASY_TO_READ ) { $ spec |= self :: CHAR_ALNUM ; } foreach ( $ this -> charArrays as $ flag => $ chars ) { if ( $ flag == self :: EASY_TO_READ ) { // handle this later continue ; } if ( ( $ spec & $ flag ) === $ flag ) { $ combined .= $ chars ; } } if ( $ spec & self :: EASY_TO_READ ) { // remove ambiguous characters $ combined = str_replace ( str_split ( self :: AMBIGUOUS_CHARS ) , '' , $ combined ) ; } return count_chars ( $ combined , 3 ) ; }
Expand a character set bitwise spec into a string character set

This will also replace EASY_TO_READ characters if the flag is set

@param int $spec The spec to expand (bitwise combination of flags)

@return string The expanded string
Expand a character set bitwise spec into a string character set