echo similar_text('Word 1', 'Word 2'); // 11
echo similar_text('This is my test', 'This is my ...'); // 11
$a = "Word 1";
$b = "Word 2";
$i = 0;
foreach(str_split($a) as $charA){
foreach(str_split($b) as $charB){
$i = ($charA === $charB)? $i++ : $i;
}
}
print_r($i)
Find more questions by tags PHP
And we need to calculate how many symbols from the second line match the first - nikita.Stracke commented on June 14th 19 at 20:08