I am writing a function php which has to do something like this:
we have two strings, ex: "Bienvenue" and "Bienbenue"
the two string don't match with the php function strpos.
but normally, the basic comportement of my function is to say, yes ok there is just one letter which differ between the two strings, so I return true. But I need some help for find an algorithm or an php function which exist?
In this example: "Bienvenue" and "Vienlpntw"
there is just "ien" which match the pattern, I have to see how many letters had matched and after that, comparate this number with the size of the word / pattern.
So we have 9 / 3 = 3; this ratio is bad, so I return false.
but in this example: "interactivity" and "intevactizity", we have "inte" "acti" and "ity" which are matching. so we have 11 of 13 letters that are corrects. So it's not easy to manage errors of letters ...
For resume, I am looking for a php function which can tell me if an entry can match or not with my pattern, return true or false respecting these points.