The scenario is this. I have an array of items, in this format:
$a = [
['name' => 'John'],
['name' => 'Doe']
];
In a further update, I get a new array with some values removed while some added. It looks like this:
$b = [
['name' => 'John'],
['name' => 'Smith']
];
How would I calculate the union and the difference of these 2, so that I can remove Doe
from my database and add Smith
since my new data has these changes?