What is the best way to do this for PHP? Is there any PHP function that can do this, considering the column content could be very large?
If PHP function is not available, what shell utility can I call?
thanks
See Question&Answers more detail:osWhat is the best way to do this for PHP? Is there any PHP function that can do this, considering the column content could be very large?
If PHP function is not available, what shell utility can I call?
thanks
See Question&Answers more detail:osthere aren't any built in diff functions in PHP. but, hooray for PEAR: Text_Diff (never used it tough, but in PEAR i trust).
and there's even a PECL package, xdiff
hint: pear classes are pure php, pecl packages are modules. normally, modules are faster than classes, but it also depends on the functionality. you just have to test and evaluate.
for storing: i'd store the plain text, not the diffs. space is cheap, many databases (e.g. mysql) support data compression (or you could de/compress in php), but if you store the plaintext, you're independent of the diff algorithm and can change it later if needed.
if you need speed, you could store both the plaintexts AND the diffs.