Skip to forum content
Code The World
We are a group of graphic designers and web developers trying to create a social network for the people, and not for the commercialization of said social network.
You are not logged in. Please login or register.
Pages 1
You must login or register to post a reply
- Registered: 2008-06-15
- Posts: 14
Topic: Similar text
This finds similar text between words.
$word2compare = "stupid";
$words = array(
'stupid',
'stu and pid',
'hello',
'foobar',
'stpid',
'upid',
'stuuupid',
'sstuuupiiid',
);
while(list($id, $str) = each($words)){
similar_text($str, $word2compare, $percent);
print "Comparing '$word2compare' with '$str': ";
print round($percent) . "%\n";
}
/*
Results:
Comparing 'stupid' with 'stupid': 100%
Comparing 'stupid' with 'stu and pid': 71%
Comparing 'stupid' with 'hello': 0%
Comparing 'stupid' with 'foobar': 0%
Comparing 'stupid' with 'stpid': 91%
Comparing 'stupid' with 'upid': 80%
Comparing 'stupid' with 'stuuupid': 86%
Comparing 'stupid' with 'sstuuupiiid': 71%
*/
- Registered: 2008-06-15
- Posts: 5
Re: Similar text
Where's the similar_text($param1, $param2, $param3) function definition?
Posts: 2
Pages 1
You must login or register to post a reply
Powered by PunBB, supported by Informer Technologies, Inc.
Currently used extensions: pun_admin_manage_extensions_improved, pun_poll, pun_quote, pun_bbcode, pun_repository, pun_tags, pun_admin_add_user, google_analytics, pun_eggdrop, pun_recaptcha.
Copyright © 2007 - 2025 CodeTheWorld