PHP code example of aheenam / similar-string

1. Go to this page and download the library: Download aheenam/similar-string library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aheenam / similar-string example snippets




use Aheenam\SimilarString\Dice;

(new Dice)('night', 'nacht') // returns 0.25
(new Dice)('abcd', 'abcd') // returns 1
(new Dice)('qwerty', 'asdf') // returns 0



use Aheenam\SimilarString\SimilarString;

(new SimilarString)->orderBySimilarity('nacht', ['night', 'abcde', 'lacht']);
// returns ['lacht', 'night', 'abcde']



use Aheenam\SimilarString\SimilarString;

(new SimilarString)->findMostSimilar('nacht', ['night', 'abcde', 'lacht']);
// returns 'lacht'