PHP code example of ilya / fuzzy

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

    

ilya / fuzzy example snippets


$rows = ['f', 'fo', 'foo', 'foob', 'fooba', 'foobar'];

$fuzzy = new \Fuzzy\Fuzzy;

$query = 'foobar';

$fuzzy->search($rows, $query, 0); // ['foobar']
$fuzzy->search($rows, $query, 1); // ['foobar', 'fooba']
$fuzzy->search($rows, $query, 2); // ['foobar', 'fooba', 'foob']
$fuzzy->search($rows, $query, 3); // ['foobar', 'fooba', 'foob', 'foo']