I have a problem in this code. I must have the intersection between tables whose count is more than 0. Then I used the function array_interset()
but when I use the condition to count I have a problem in this code:
$iheb1 =
array_intersect(
if(count($tab0)>0) { $tab0, }
if(count($tab1)>0) { $tab1, }
if(count($tab2)>0) { $tab2, }
if(count($tab3)>0) { $tab3, }
if(count($tab4)>0) { $tab4, }
if(count($tab5)>0) { $tab5, }
if(count($tab6)>0) { $tab6 }
);
There many issues here. The big one being your if statements in the parameters of array_intersect.
Try this:
First add all of the arrays to an array or arrays (i used $full_array).
$array_to_test = array();
foreach($full_array as $arr){
if(count($arr)>0){
array_push($array_to_test, $arr);
}
}
$iheb1 = array_reduce($array_to_test,function(&$a,$b) {$a = array_intersect($a,$b);},Array());
I found a similar question to yours and this seems to be working.