PHP code example of vladis84 / text-compare

1. Go to this page and download the library: Download vladis84/text-compare 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/ */

    

vladis84 / text-compare example snippets


$comparison = new Comparison();
        
$comparison
    ->addFilter(new SpaceFilter)
    ->addDriver(new TanimotoDriver)
;

$result = $comparison->compare('Hello', [' hello ', 'HEL']);

$result = [
    'tanimoto' => [
        ['percent' => ***, 'needle' => 'Hello', 'haystack' => ' hello '],
        ['percent' => ***, 'needle' => 'Hello', 'haystack' => 'HEL'],
    ],
];