Re: [PHP] foreach / unset

2005-10-28 Thread Richard Lynch
On Fri, October 28, 2005 8:47 am, Jochem Maas wrote: > John Nichel wrote: >> Richard Lynch wrote: >> >>> Somewhere in the manual (damned if I can find it now) it says (or >>> used >>> to say) that you can or can't safely do this: >>> >>> while (list($k, $v) = each($array)){ >>> if (...) unset($ar

Re: [PHP] foreach / unset

2005-10-28 Thread Jochem Maas
John Nichel wrote: Richard Lynch wrote: Somewhere in the manual (damned if I can find it now) it says (or used to say) that you can or can't safely do this: while (list($k, $v) = each($array)){ if (...) unset($array[$k]); } I don't even remember if it's safe or not, but I swear I saw it not

Re: [PHP] foreach / unset

2005-10-28 Thread John Nichel
Richard Lynch wrote: Somewhere in the manual (damned if I can find it now) it says (or used to say) that you can or can't safely do this: while (list($k, $v) = each($array)){ if (...) unset($array[$k]); } I don't even remember if it's safe or not, but I swear I saw it not that long ago... An

Re: [PHP] foreach / unset

2005-10-28 Thread Brent Baisley
The foreach statement works because you are getting the array index ($k) to unset the array item. I think somewhere in the manual it says it's unsafe because some people might think you could just use unset ($v) to unset the array item. Which wouldn't work because $v is more of a temporary v

Re: [PHP] foreach / unset

2005-10-28 Thread Jochem Maas
Richard Lynch wrote: Somewhere in the manual (damned if I can find it now) it says (or used to say) that you can or can't safely do this: while (list($k, $v) = each($array)){ if (...) unset($array[$k]); } I don't even remember if it's safe or not, but I swear I saw it not that long ago... An

Re: [PHP] foreach / unset

2005-10-28 Thread Karlos Zafra
This syntax has the work done perfectly for me. 2005/10/28, Niels Ganser <[EMAIL PROTECTED]>: > > Why should this be "unsafe" (whatever the heck that means) in any way? Of > course you can do it. > > Regards, > Niels. > > [sorry for mailing to your private address. wrong button :)] > > > Anyway, c

Re: [PHP] foreach / unset

2005-10-27 Thread Niels Ganser
Why should this be "unsafe" (whatever the heck that means) in any way? Of course you can do it. Regards, Niels. [sorry for mailing to your private address. wrong button :)] > Anyway, can you do *this* safely as a DOCUMENTED FEATURE: > > foreach($array as $k => $v){ >   if (...) unset($array[$k]

[PHP] foreach / unset

2005-10-27 Thread Richard Lynch
Somewhere in the manual (damned if I can find it now) it says (or used to say) that you can or can't safely do this: while (list($k, $v) = each($array)){ if (...) unset($array[$k]); } I don't even remember if it's safe or not, but I swear I saw it not that long ago... Anyway, can you do *this*