PHP: how to do array_search with 40% Partial Matching -


i using php partial matching. problem there huge list of matching available every time. want limit it. shows partial match when matches 40 % (means 4 characters out of 10).

try this:

function fuzzymatch ($source, $term, $percentrequired){     $matches = array_filter($source, function($test) use ($term, $percentrequired){            $matchper = null;            similar_text($term, $test, $matchper);            return $matchper >= $percentrequired;     });     return $matches; } 

this take array or terms, term want match against , % required match , return array matching values.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -