How can foreach process multiple arrays at the same time? for example, I have three arrays $ array_a $ array_ B $ array_c. my requirements are as follows: each foreach can output a foreach ($ array_aas $ a; $ array_bas $ B; $ array_cas $ c;) {echo $. & quot ;. $ B. & quot; & foreach how to process multiple arrays at the same time
For example, I have three arrays $ array_a $ array_ B $ array_c
My requirement is: each foreach can output an item of each array at the same time.
Similar to this
Foreach ($ array_a as $ a; $ array_ B as $ B; $ array_c as $ c ;){
Echo $ a. "". $ B. "". $ c;
}
Of course, the syntax in the brackets above foreach should be wrong. how should we implement it?
------ Solution --------------------
Doesn't foreach mean the same thing?
Foreach ($ array_a as $ k => $ v ){
Echo $ v. "". $ array_ B [$ k]. "". $ array_c [$ k]."
";
}