1

我有这样的表格=

Name 1
First Name  :  <input type='text' name='firstname'>
Middle Name :  <input type='text' name='middlename'>
Last Name   :  <input type='text' name='lastname'>


Name 2
First Name  :  <input type='text' name='firstname2'>
Middle Name :  <input type='text' name='middlename2'>
Last Name   :  <input type='text' name='lastname2'>

当输入“名称 1”和“名称 2”时,我想要这样的结果:

`example : <br>
 Name 1 = michael smith <br>
 Name 2 = michael nick smith <br>
 Percentage similar of "Name 1" and "Name 2" is = 80% `  

请帮我

4

1 回答 1

0

只使用这个http://www.php.net/manual/en/function.similar-text.php这就是你所需要的。

$var_1 = 'PHP IS GREAT'; 
$var_2 = 'WITH MYSQL'; 

similar_text($var_1, $var_2, $percent); 

echo $percent; 
// 27.272727272727 

您的代码的实时示例http://codepad.viper-7.com/nyHukz

$var_1 = 'michael smith'; 
$var_2 = 'michael nick smith'; 

similar_text($var_1, $var_2, $percent); 

echo $percent; 
//83.870967741935
于 2012-12-14T04:18:59.897 回答