I wonder how to compare two almost identical strings and output another string containing the new and the old value. It has to work wordwise. Actually its exactly what you can see on this page in the edit-history.
Example:
$string1 = 'A very, very nice day today.';
$string2 = 'An almost nice day today';
$output = compare_strings($string1, $string2);
Outputs: "A very, very An almost nice day today. today"
I know there is the text_diff package, but I want to know exactly how to do it manually.
I thought of creating an array with one entry per word and then compare them, but I don't know how to compare the best.