I have a multidimensional array and I want to change it to my final array. Below is the array I have.
$test = array(
array(
"supplier" => "TEST DEPO",
"rolanID" => array(123, 234, 456),
"itemCount" => 3
),
array(
"supplier" => "ANOTHER DEPO",
"rolanID" => array(123, 786, 345),
"itemCount" => 3
),
array(
"supplier" => "ROLAN",
"rolanID" => array(123, 234),
"itemCount" => 2
),
);
So, with this array I want to output like the below array.
As we can see, if all rolanID is equal to one of the supplier then I don’t want to add that array into the final array.
For, an example the supplier “ROLAN” array is removed completely in the final array as its all rolanID is in the supplier “TEST DEPO” but the supplier “ANOTHER DEPO” has some rolanID that is not in the supplier “TEST DEPO” so, it is included that in the final array.
Array
(
[0] => Array
(
[supplier] => TEST DEPO
[rolanID] => Array
(
[0] => 123
[1] => 234
[2] => 456
)
[itemCount] => 3
)
[1] => Array
(
[supplier] => ANOTHER DEPO
[rolanID] => Array
(
[0] => 786
[1] => 345
)
[itemCount] => 2
)
)




