in reply to Scoping of my with foreach loop

Neither will compile? No, wait. That's a similarity. :)

Assuming you meant $item in each case, the difference would be in the scope of $item. In the second case it would be limited to the foreach block.