Name: Anonymous 2010-09-08 4:41
PHP has a function that does it. How would I implement it? Considering string shifting and single character differences, that's a lot of cases to go through.
function similarity($a, $b) {
$similarity = 0;
for ($i=0; i < strlen($a); $i++) {
if ($a[$i] == $b[$i])
similarity++;
else
similarity--;
}
return $similiarity / strlen($a);
}