If this is $array_b
$array_b = array('red', 'green', 'blue');
What's an efficient way to compare it to $array_a
and get a boolean as to whether $array_a
contains all elements of the above $array_b
.
This is the output I'm trying to get to
//false, because it's missing the red from `$array_b`
$array_a = array('green', 'blue');
//true, because it contains all 3 from `$array_b`
$array_a = array('red', 'green', 'blue');
//true, because it contains all 3 from `$array_b`
//even though there's an extra orange and cyan
$array_a = array('red', 'green', 'blue', 'orange', 'cyan');
What's a good way to do this without nasty nested loops that are hard to keep track of?