Skip to content

Instantly share code, notes, and snippets.

@firejune
Created June 29, 2016 03:27
Show Gist options
  • Save firejune/f70739fbf0346b45df64b73323397ef9 to your computer and use it in GitHub Desktop.
Save firejune/f70739fbf0346b45df64b73323397ef9 to your computer and use it in GitHub Desktop.
Compare Two Strings
<?
function compareText($str1, $str2) {
$str1 = split(" ", $str1);
$str2 = split(" ", $str2);
$count = 0;
for ($i = 0; $i < sizeof($str1); $i++) {
for ($j = 0; $j < sizeof($str2); $j++) {
if ($str1[$i] == $str2[$j]) $count++;
}
}
return ($count * 100) / sizeof($str1);
}
echo compareText('스타크래프트2 - 군단의 심장 시네마틱', 'RT @firejune: 스타2 군단의 심장 시네마틱 http://t.co/zqeBuuOI')
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment