我有一些PHP函数给出了两个JSON文件,将它们合并成一个来满足特定的规格。但是,我需要添加一个特性,使用PHP合并两个文件的内容字符串。这些字符串可能在它们之间的某个点上有不同的文本。
示例
JSON-1
"elements":[
...
{
"type": "text",
"content": "It went up the tree! Then climbed down.",
},
...
]JSON-2
"elements":[
...
{
"type": "text",
"content": "I saw your cat. It went up the tree! Then it run away!",
},
...
]我需要合并的文件
JSON-合并的
"elements":[
...
{
"type": "text",
"content": "<la>I saw your cat.</la> It went up the tree! <po>Then climbed down.<po> <li> Then it run away!</li>",
},
...
]知道我该怎么做吗?我想要“爆炸”数组中的内容,然后互相迭代以查看匹配的内容。但那样的话,相似的话,在不同的背景下,将匹配和混乱的代码!
发布于 2012-08-22 16:35:22
那FineDiff呢?
http://www.raymondhill.net/finediff/finediff-code.php
http://www.raymondhill.net/finediff/viewdiff-ex.php
发布于 2012-08-22 15:22:41
尝试一下Text_Diff:Diff/
https://stackoverflow.com/questions/12075386
复制相似问题