3

I'm working with the Text_Diff PEAR package to diff to short text documents, where the Text_Diff object is created with a space-delimited list of the words in each document. I was hoping to store the diff in a database, and then apply it when the file is loaded again. Is there an easy way to apply this diff, or do I need to write a function to parse it?

PEZ
  • 16,821
  • 7
  • 45
  • 66
pschorf
  • 519
  • 1
  • 10
  • 23

1 Answers1

3

The php xdiff extension supports patching from both files and strings. Looking at the source for Text_Diff I see that it uses xdiff for performing the diffs. You should be able to patch using xdiff_string_patch() or some of it's sibling functions.

ChrisMoll
  • 365
  • 1
  • 12
PEZ
  • 16,821
  • 7
  • 45
  • 66