How to check it elemets of an array are in another array

  array-difference, array-intersect, arrays, php

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

Source: Ask PHP

LEAVE A COMMENT