php比较相似字符串的方法_php技巧_脚本之家

此地透过php的similar_www.6766.com,text函数比较四个字符串的相同性。

本文实例叙述了php相比平常字符串的艺术。分享给大家供大家参考。具体分析如下:

$word2compare = "stupid";$words = array( 'stupid', 'stu and pid', 'hello', 'foobar', 'stpid', 'upid', 'stuuupid', 'sstuuupiiid',);while = each{ similar_text($str, $word2compare, $percent); print "Comparing '$word2compare' with '$str': "; print round . "%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%*/

梦想本文所述对大家的php程序设计有着帮助。

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图