0
I would like to know how to calculate the similarity, in percentage, between two strings with PHP?
For example:
- I got you a present!
- I want some presents from you!
0
I would like to know how to calculate the similarity, in percentage, between two strings with PHP?
For example:
1
The best native form of PHP itself is this:
$var_1 = 'Eu tenho um presente pra vocês!';
$var_2 = 'Eu quero alguns presentes de vocês!';
similar_text($var_1, $var_2, $percentual);
echo $percentual;
// 73.529411764706
Demo: http://sandbox.onlinephpfunctions.com/code/2ac97ccb9a14cf093f4c7fe6580ed626dda1e855
Browser other questions tagged php text-pattern
You are not signed in. Login or sign up in order to post.