Railsbin – The vulnerable pastebin service!

User:

Title: lendiff

Content:

function get_tbs_diff($a, $b)
{
	$a = strtolower($a);
	$b = strtolower($b);
	$a = preg_replace('/[^a-z]/', '', $a);
	$b = preg_replace('/[^a-z]/', '', $b);
	$la = strlen($a);
	$lb = strlen($b);
	$min = min([$la, $lb]);
	$diff = 0;
	for ($i = 0; $i < $min; $i++)
	{
		$oa = ord($a);
		$ob = ord($b);
		$d = abs($oa - $ob);
		$diff += $d;
	}
	$diff += abs($la - $lb);
	return $diff;
}

Edit | Back