Is it possible to have a foreach
loop in PHP with multiple \"index\" variables, akin to the following (which doesn\'t use correct syntax)?
forea
No, because those arrays may have other number of items.
You must explicitely write something like that:
for ($i = 0; $i < count($courses) && $i < count($sections); ++$i) {
$course = $courses[$i];
$section = $sections[$i];
//here the code you wanted before
}
like this?
foreach($array as $b=>$c){
}