I am very very new to PHP so please bear with my naivety,
I am doing an array_intersect and want to use the results to create another table; the following is an example of where I am now and I am stuck.
<?php
$array_1 = array(1,2,3,4,5,6,7);
$array_2 = array(3,8,0,9,7);
$common = array_intersect($array_1, $array_2);
foreach ($common as $value) {
echo $value;
}
?>
The answer is 37
My problem is I am looking for a way to COUNT/ADD the echoed answer instead of the actual 37 which is the intersection. What I mean is, instead of 37, I want to write the code to give me 2 which is the count of the 3 and 7. That is "2" being the number of times of the intersect. If it is 0 then 0 is the number of times of intersection and so on and so forth.
Does anyone who how I can do this please