public function similarity($text1, $text2)
    {
        $similarity = 0;
        $hash1 = $this->hashString($text1);
        $hash2 = $this->hashString($text2);        
        
        $keys = array_keys(array_intersect_key($hash1, $hash2));
        foreach($keys as $key)
        {
            if($hash1[$key] === $hash2[$key] && $hash1[$key] >= $this->limit)
            {
                $similarity += $hash1[$key];
            }
        }        
        return $similarity;
    }
public function similarity($text1, $text2)
    {
        $similarity = 0;
        $hash1 = $this->hashString($text1);
        $hash2 = $this->hashString($text2);        
        
        $keys = array_keys(array_intersect_key($hash1, $hash2));
        foreach($keys as $key)
        {
            if($hash1[$key] === $hash2[$key] && $hash1[$key] >= $this->limit)
            {
                $similarity += $hash1[$key];
            }
        }        
        return $similarity;
    }
public function similarity ( $ text1 , $ text2 ) { $ similarity = 0 ; $ hash1 = $ this -> hashString ( $ text1 ) ; $ hash2 = $ this -> hashString ( $ text2 ) ; $ keys = array_keys ( array_intersect_key ( $ hash1 , $ hash2 ) ) ; foreach ( $ keys as $ key ) { if ( $ hash1 [ $ key ] === $ hash2 [ $ key ] && $ hash1 [ $ key ] >= $ this -> limit ) { $ similarity += $ hash1 [ $ key ] ; } } return $ similarity ; }
Returns the most frequently used letter with the same
frequency
@param string $text1
@param string $text2
@return int
Returns the most frequently used letter with the same frequency