I currently have a while loop which has another while loop running inside of it, I want to reference a value which is changed by the first loop each time the second loop is run.
$counter = 0;
$counter2 = 2;
while ($counter < 7) {
$name = 0;
while ($array[$counter2][2] == !false) {
if ($array[$counter2][3] == "string") {
if ($array[$counter2][2] == $counter) {
$name = 1;
}
}
$counter2++;
}
$counter++;
}
When I run the above and do the second IF statement the value of $counter is 0 even though this should go up through each iteration of the first loop.
How do I get the value of $counter in the second while loop to match the $counter I am using in the first while loop?
The second loop was only ever running once because the array search would always start off as false due to the fact I wasn't resetting the second counter each time the first loop was run.