Text Difference
PHP Code
Please Register to submit score.
| Average Score | 6.0 (of 1 scores) |
| Date Added | Dec 31, 2006 |
| Last Updated | Dec 31, 2006 |
| Tags | difference text |
Description
Shows differences in two strings of text.
This snippet requires the PEAR Text_Diff package, available from http://pear.php.net/package/Text_Diff.
The class can be use like this:
$diff = new diff($from_text,$to_text);
echo $diff->render();
This will show you the difference in $from_text to $to_text. Text that was added will be shown in green, text that was removed will be shown in red.
A full example of the script is located at http://www.tye.ca/php/diff/
This script will work in PHP4 and PHP5. Lines commented with # are PHP5 equivalents of the lines directly above them (this script was originally written for PHP5).
This snippet requires the PEAR Text_Diff package, available from http://pear.php.net/package/Text_Diff.
The class can be use like this:
$diff = new diff($from_text,$to_text);
echo $diff->render();
This will show you the difference in $from_text to $to_text. Text that was added will be shown in green, text that was removed will be shown in red.
A full example of the script is located at http://www.tye.ca/php/diff/
This script will work in PHP4 and PHP5. Lines commented with # are PHP5 equivalents of the lines directly above them (this script was originally written for PHP5).
I can see how this would be useful as a mySQL function, but I haven't found a use for it yet in PHP code.





