得到两个句子之间的区别

时间:2011-10-29 05:03:58

标签: php string intersection

我想在Php中找出两个句子之间的区别, 例如

$a1 = explode(" ",'This is just a tweet tweet');
$a2 = explode(" ",'waste of time This is just a stupid tweet get a life');

//I need the output to be Statement1:waste of time Statement2:stupid Statement3: get a life

function fullArrayDiff($left, $right)
{
    return array_diff(array_merge($left, $right), array_intersect($left, $right));

//This does not take care of the 
}

我尝试了最长的常用序列,但它没有得到我想要的

任何身体都可以提供帮助吗?这个算法有名称吗? 提前致谢

1 个答案:

答案 0 :(得分:1)