foreach

    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?

    Hopelessly lost. Any explanation would be appreciated.

    Source: http://community.livejournal.com/php/414789.html

« E-commerce starter || Image Upload Script -... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home