更新时间:2022-10-14 18:40:39
实现这个结果你可以做
$ foreach(array_combine($ courses,$ sections)as $ course => gt ; $ section)
只适用于两个数组
Is it possible to have a foreach
loop in PHP with multiple "index" variables, akin to the following (which doesn't use correct syntax)?
foreach ($courses as $course, $sections as $section)
If not, is there a good way to achieve the same result?
to achieve just that result you could do
foreach (array_combine($courses, $sections) as $course => $section)
but that only works for two arrays