Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
922 views
Welcome To Ask or Share your Answers For Others

1 Answer

there 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...