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
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
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
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
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
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
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]
7 matches
Mail list logo