foreach($foo as &$bar) {
//do something
}
This is the syntax for a foreach loop in PHP. Usually, $foo
& $bar
are different variables, but my question is can they be the same variable? I'm asking if PHP will let me, not whether it is possible to write the code like that. I know this would modify the variable inside the loop, and I'm not worried about that.