I have an issue, I have this array
$items= array('ABC','DEF',GHI');
and have another two arrays
$array1 = array('ABC','DEF',GHI');
$array2 = array('DEF');
$array1 should return TRUE because all elements are in $items
$array2 should return FALSE because 'ABC' and 'GHI' arent in that array
i've tried with array_intersect and array_diff but i cant get it,
$result = array_intersect($items,$array1);
$result = !array_diff($items,$array1);
Could you please help me? Regards Mario
To see if the array contains at least all values in
$items, just get all values from the array that are also in$itemsand compare it with$items:If you just need to compare the arrays:
But why is this not working for you: