Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calculate text diffs in PHP [duplicate]

Tags:

php

diff

Are there any libraries (3rd party or built-in) in PHP to calculate text diffs?

like image 665
nickf Avatar asked Sep 21 '08 23:09

nickf


1 Answers

What sort of diffs? File diffs? There is array_diff() which acts on arrays. Then there is also xdiff, which "enables you to create and apply patch files containing differences between different revisions of files.". The latter acts on files or strings.

Edit: I should add xdiff doesn't appear to be out in a release yet. You have to build from source to use it.

like image 164
Jonah Braun Avatar answered Sep 30 '22 05:09

Jonah Braun