I'm having troubles comparing two arrays with array_inersect(), tried lot of suggestion from SO but none worked. So here is my problem:
I have two arrays:
$base_array = array(2,2,2,1);
Array
(
[0] => 2
[1] => 2
[2] => 2
[3] => 1
)
And another one $risks that prints like this:
Array
(
[0] => 2
[1] => 3
[2] => 4
[3] => 1
[4] => 2
[5] => 8
[6] => 6
)
What I want is to see if the same number and type of values from $base_array fits into $risks array. Right now it should return false cause I only have two occurences of number 2 and base array has 3. But if I set $base_array to:
$base_array = array(2,2,1);
This should return true.
$base_array? i.e we are checking if there are two 2's and one 1, right?array_intersectandarray_diffin your question, and in which sense they didn't work. Then we can/will help.$base_arraybut if we set$base_array = array(2,2,1);it should return True.