i have two arrays as following
$fix=array(2,4,5,6);
$marks=array(2,4,6,8);
i want to get if same number has same index in two arrays count it and i want to get final total as 2, i wrote some code but it not work i refer for this code php array comparison index by index
$total=0;
$r = array_map(function($fix, $marks) {
if( $fix === $marks){
$total=$total+1;
return $total;
}
}, $fix, $marks);
echo $total;