开发者

How do I compare two array's values?

开发者 https://www.devze.com 2023-01-29 23:58 出处:网络
I have 2 arrays one retrieved from a database (saved results) and the other from an xml (new results)

I have 2 arrays one retrieved from a database (saved results) and the other from an xml (new results)

$fromDB = array('123','124','524','15','616');
$开发者_Go百科fromXML = array('123','124','524','15','818');

I want to compare those two and see which values are old (fromDB) and which are new (fromXML) so to insert the old value in a different table.

How can i achieve this?


The array_diff function is what you're looking for.


Take a look at the array_diff() function

0

精彩评论

暂无评论...
验证码 换一张
取 消