Date: 02/15/06 (PHP Community) Keywords: php I can't understand the damn foreach PHP expression. I get that it just assigns the current array element value to the value supplied by $v or $k, but I don't understand the second option (according to php.net manual) that says you can use "$k as $v" and that assigns it to the variable $key on each loop. Wtf is the difference? It's assigning a value to a variable for use in the statement both times - what difference does it make if there's an array key expression in the statement to be evaluated?
|