Location: Homepage / Inline-diff

PHP inline diff - tool to produce inline diffs

1 Overview
2 Distribution and usage license
3 Download files
4 Maintainer details

Update: the inline renderer is now a native part of the Text_Diff PEAR package. You don't need to use the hack presented here anymore. This page is kept for reference only.

1 Overview

If you have two strings: "my blue pen" and "my red pen", this is the diff my hack will produce: "my <del>blue</del><ins>red</ins> pen".

I created this in order to be used in a wiki (Wikki Tikki Tavi) but I suppose you can find other applications for it.

It is a rather simple hack. It does the following:

The package has these files:
inline_example.php = shows how to use the diff maker
inline_function.php = the function which does everything
inline_renderer.php = my hacked diff renderer

You either need to install Text_Diff from PEAR on your machine's PEAR repository (do a 'pear help' on the command line if you don't know how), or you can include that package in your source. It's not big, it only has a few files.

Read the code for any additional details you may need. There are a few tips about optimizing it for PHP5 in there.

2 Distribution and usage license

This package is distributed under the terms of the GNU General Public License. You are encouraged to use and distribute it at will, as long as you act according to the GPL.

3 Download files

4 Maintainer details