Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Why would anyone enter a loop and expect the iteration variable to have a value defined outside the loop?

Thus us the takeaway point, I think. The loop would work perfectly fine if $bar was lexically scoped to the foreach, but it isn't. That's a general weakness in PHP compared to pretty much any other scripting language used today.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: