Apply Diff in PHP

I am working with the Text_Diff PEAR package to describe short text documents, where a Text_Diff object is created using a list of words in each document, separated by spaces. I was hoping to save the diff in the database and then apply it when the file is downloaded again. Is there an easy way to apply this diff, or do I need to write a function to parse it?

+3
source share
1 answer

The php xdiff extension supports patching from both files and strings. Looking at the source of Text_Diff, I see that it uses xdiff to make the differences. You should be able to fix with xdiff_string_patch () or some of its functions for sisters.

+3
source

All Articles