PHP code example of wataridori / simple-fuzzy-search
1. Go to this page and download the library: Download wataridori/simple-fuzzy-search 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/ */
wataridori / simple-fuzzy-search example snippets
$arrayData = [
[
'nickname' => 'thangtd90',
'fullname' => 'Tran Duc Thang',
],
[
'nickname' => 'trongbs',
'fullname' => 'Tran Ba Trong',
],
[
'nickname' => 'vigov5',
'fullname' => 'Nguyen Anh Tien',
],
[
'nickname' => 'kienBG',
'fullname' => 'Do Trung Kien',
],
[
'nickname' => 'vuong',
'fullname' => 'Nguyen Van Vuong',
],
[
'nickname' => 'dainghia',
'fullname' => 'Le Van Nghia',
],
[
'nickname' => 'tungctf',
'fullname' => 'Nguyen Duc Tung',
],
];
// Find by both nickname and fullname
$sfs = new SimpleFuzzySearch($this->arrayData, ['nickname', 'fullname'], 'tung');
// This will return "Nguyen Duc Tung" and "Do Trung Kien"
$results = $sfs->search();
// This will return "Tran Duc Thang"
$results = $sfs->search('trn dc thsng');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.