I’ve looked through several resources and could not come up with something, so I thought I would ask you guys if you knew of a script to do what I want, or have any thoughts on how to build one.
I am going to have a MySQL table with 2 text fields. I want to generate a differences report between the text fields.
One mthod I thought of would be to explode each field by spaces. Then, loop through the field2 array. If the array item matches the same array item in the field1 array item, then advance the array key. If it does not match, add an opening span, and advance the field2 array only. Once they match up again, clase the span and continue on.
Problem I see, this method only produces output where field2 has additional words that field1 does not. It does not take into account any deletions.
I guess I could do the opposite for the other field and then display each field with highlighted text that is not contained in the other one. But, I’d rather have all the difference higlights be located in only one displayed field.
Any suggestions on how to proceed, or know of any scripts that do this?