anche similar_text sembra interessante.
ma è molto lento pare.
Codice PHP:
<?php
$term = 'cheese';
foreach(array('gouda', 'gruyere', 'cheddar') as $match) {
echo similar_text($term, $match, $percent),
" characters from '$term' were contained in '$match'.\n",
"Overall, '$term' is a ", round($percent),
"% match for '$match'\n\n";
}
?>
Output:
0 characters from 'cheese' were contained in 'gouda'.
Overall, 'cheese' is a 0% match for 'gouda'
2 characters from 'cheese' were contained in 'gruyere'.
Overall, 'cheese' is a 31% match for 'gruyere'
3 characters from 'cheese' were contained in 'cheddar'.
Overall, 'cheese' is a 46% match for 'cheddar'