compare difference in nested numeric array

Subject:

You can define a custom comparison function using array_udiff().

function udiffCompare($a, $b) { return $a['ITEM'] - $b['ITEM']; } $arrdiff = array_udiff($arr2, $arr1, 'udiffCompare'); print_r($arrdiff);

Output:

Array ( [3] => Array ( [ITEM] => 4 ) )

This uses and preserves the arrays' existing structure, which I assume you want.ref: http://stackoverflow.com/questions/11821680/array-diff-with-multidimensional-arrays

2017-03-14 15:39:26gstlouis