I have two strings which starts out the same, but at some point are different. I want to find how many characters the two strings share in common.
It seems like strpos
is the opposite of this; it assumes that one string is found completely in another, but not necessarily at the starting offset.
I see a lot of questions which ask about finding common substrings when they aren't at the start, or when there are more than two strings, and this seems to complicate things quite a bit. I have just two strings, and they have a common prefix. IS there a PHP function to get the index at which these two strings differ?