src/Matchers/DictionaryMatch.php
protected static function dictionaryMatch($password, $dict)
    {
        $result = [];
        $length = strlen($password);

        $pw_lower = strtolower($password);

        foreach (range(0, $length - 1) as $i) {
            foreach (range($i, $length - 1) as $j) {
                $word = substr($pw_lower, $i, $j - $i + 1);

                if (isset($dict[$word])) {
                    $result[] = [
                        'begin' => $i,
                        'end' => $j,
                        'token' => substr($password, $i, $j - $i + 1),
                        'matched_word' => $word,
                        'rank' => $dict[$word],
                    ];
                }
            }
        }

        return $result;
    }
protected static function dictionaryMatch($password, $dict)
    {
        $result = [];
        $length = strlen($password);

        $pw_lower = strtolower($password);

        foreach (range(0, $length - 1) as $i) {
            foreach (range($i, $length - 1) as $j) {
                $word = substr($pw_lower, $i, $j - $i + 1);

                if (isset($dict[$word])) {
                    $result[] = [
                        'begin' => $i,
                        'end' => $j,
                        'token' => substr($password, $i, $j - $i + 1),
                        'matched_word' => $word,
                        'rank' => $dict[$word],
                    ];
                }
            }
        }

        return $result;
    }
protected static function dictionaryMatch ( $ password , $ dict ) { $ result = [ ] ; $ length = strlen ( $ password ) ; $ pw_lower = strtolower ( $ password ) ; foreach ( range ( 0 , $ length - 1 ) as $ i ) { foreach ( range ( $ i , $ length - 1 ) as $ j ) { $ word = substr ( $ pw_lower , $ i , $ j - $ i + 1 ) ; if ( isset ( $ dict [ $ word ] ) ) { $ result [ ] = [ 'begin' => $ i , 'end' => $ j , 'token' => substr ( $ password , $ i , $ j - $ i + 1 ) , 'matched_word' => $ word , 'rank' => $ dict [ $ word ] , ] ; } } } return $ result ; }
Match password in a dictionary.

@param string $password
@param array  $dict

@return array
Match password in a dictionary .