I want to compare two arrays in php. I don't want to do it overall, but block by block.
kind of like this
if (a[1] == b[1]){ // do something }
if (a[2] == b[2]){ // do more }
how can i do this without a whole bunch of ifs
?
thanks in advance :)
$a = array(1, 2, 3, 5);
$b = array(1, 1, 1, 1);
$c = array('something', 'something', 'and so forth');
foreach($a as $key => $value){
if($value == $b[$key]){
echo $c[$key]. '<br />';
}
}
my answer. compare 2 arrays, then rune some code. triggered by the blocks that match