PHP Show Differences
I have two strings:
$stringA = "1,2,3,4";
$stringB = "1,2,4,5";
I want to pick out the values from $stringB
that are not in $stri开发者_运维问答ngA
.
How can I do that?
A combination of explode and array_diff should get you there.
array_diff(explode(',', $stringB), explode(',', $stringA));
http://pear.php.net/package/Text_Diff/
That should help you out ...
explode()
both arrays and use array_diff()
to compute differential array.
精彩评论