简而言之,我正在寻找类似 PHP 中的 google-diff-match-patch 的东西。
我在 SO 看过一些类似的问题,也看过提供的算法 here ,但都失败了:
diff("draßen", "da draußen")
不应该给
<del>draßen</del> <ins>da draußen</ins>
(这对我来说有点愚蠢,因为我想比较文件名),但是 (try here)
<ins>da </ins>dra<ins>u</ins>ßen
PHP 中是否有执行此操作的代码片段?不幸的是,我不能使用(即安装)外部包。
最佳答案
https://github.com/gorhill/PHP-FineDiff支持字符差异,并可以在 HTML 中呈现差异
关于php - PHP 中的字符字符串差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3307292/