[PHP] Re: foreach / unset
by Bogdan Ribic other posts by this author
Oct 29 2005 3:07AM messages near this date
[PHP] foreach / unset
|
Re: [PHP] foreach / unset
Richard Lynch wrote:
>
> Anyway, can you do *this* safely as a DOCUMENTED FEATURE:
>
> foreach($array as $k => $v){
> if (...) unset($array[$k]);
> }
>
Well, somewhere in the said manual it is written that foreach operates
on a *copy* of the array, so you should be safe unsetting values in the
original array while iterating through the copy.
--
Open source PHP code generator for DB operations
http://sourceforge.net/projects/bfrcg/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thread:
Richard Lynch
Bogdan Ribic
John Nichel
Jochem Maas
Richard Lynch
Brent Baisley
Jochem Maas
Niels Ganser
Karlos Zafra
|