Nesting a Foreach Loop inside a For Loop

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cvalarmathi
    New Member
    • May 2007
    • 12

    Nesting a Foreach Loop inside a For Loop

    Hi ! How to write foreach loop within for loop in php.Plz anybody know the answer reply me.Is it possible? Thanks.

    [Bold is for emphasis (and mod comments), not for your entire post content. Thanks! --pbmods]
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Changed thread title to better match contents.

    Have you tried nesting the loops? It works.

    [code=php]
    for($i = -1; $i < somenumber; ++$i)
    foreach($someAr ray[$i] as $idx => $val)
    doSomething($va l);
    [/code]

    Comment

    Working...