Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm looking for an free php library that can generate code diff HTML. Basically just like GitHub's code diffs pages.

I've been searching all around and can't find anything. Does anyone know of anything out there that does what I'm looking for?

share|improve this question
Searching "PHP diff" came up with several promising entries. github.com/chrisboulton/php-diff – Brad Mar 8 at 21:27

2 Answers

I think what you're looking for is xdiff.

xdiff extension enables you to create and apply patch files containing differences between different revisions of files.

This extension supports two modes of operation - on strings and on files, as well as two different patch formats - unified and binary. Unified patches are excellent for text files as they are human-readable and easy to review. For binary files like archives or images, binary patches will be adequate choice as they are binary safe and handle non-printable characters well.

share|improve this answer

It looks like I found what I'm looking for after doing more Google searches with different wording.

php-diff seems to do exactly what I want. Just a php function that accepts two strings and generates all the HTML do display the diff in a web page.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.