I\'ve had some success comparing strings using the PHP levenshtein function.
However, for two strings which contain substrings that have swapped positions, the algorithm
Its easy. Just use the Damerau-Levenshtein distance on the words instead of letters.