I have the following (nested) array:
array(3) { [16]=> array(3) { [0]=> int(159) [1]=> int(160) [2]=> int(158) }
[21]=> array(2) { [0]=> int(160) [1]=> int(158) }
[19]=> array(2) { [0]=> int(158) [1]=> int(159) } }
As you can see it contains 3 child array's. The child array's all contain the integer '158' as an value but also '159'. I want to somehow loop trough the child array's and do a check if all child array's contain that value. Then I want to return an array with only these values.
I know i could use array_intersect for this however the nested array's are generated dynamically so i'm not sure how to deal with this using array intersect:
<?php
$arr1 = array('158','250','342');
$arr2 = array('158','142','352');
$diff1 = array_intersect($arr1, $arr2);
print_r( $diff1 );
//RETURNS Array ( [0] => 158 )
?>