Here's the situation: I have many pairs of 2 strings that may (or may not) match each other from the beginning up to a certain point, then become different. What's the "best" (efficient, clean, etc) way of determining 1). the matching parts of the two strings 2). the part of each that's different?
$string1 = "the date is today";
$string2 = "the date is tomorrow";
$matchingpart = "the date is to"
$diff1 = "day"
$diff2 = "morrow"
It isn't hard to iterate over the first string letter by letter and do comparison to the second, but it really seems like there should be a more... elegant solution. Any ideas?