I'm not even sure what the subject of this question should be - forgive me...
I have a number of arrays defined:
$array1;
$array2;
$array3;
and a variable that tells me how many arrays there are:
$arraycount = 3;
I want to pull the same position value out of each array, through all the arrays, like this:
if ($array1[2] == 'monkey') {
echo "something";
}
if ($array2[2] == 'monkey') {
echo "something";
}
if ($array3[2] == 'monkey') {
echo "something";
}
And I KNOW there's a way to do it using a for() loop, but I forget how. It's not:
for ($i=1; $i<=$arraycount; $i++) {
if ($array . $i[2] == 'monkey') {
echo 'something';
}
}
The syntax on line 2, trying to append the value for $i to the term "$array", isn't working, naturally, and I can't remember how to write this.
Can someone set me straight?
Thanks!