Tuesday, February 14, 2012

Multiple variables access through foreach in php



foreach ($courses as $course, $sections as $section, $example as $example)



any ways to add more than 2?



i only know the solution to 2 variables.




foreach (array_combine($courses, $sections) as $course => $section)

1 comment:

  1. if all array has same keys then

    foreach ($courses as $key => $course)
    {
    echo $sections[$key];
    echo $example[key];
    }

    ReplyDelete