You are here: Re: safe to delete elements of array in foreach « PHP Programming Language « IT news, forums, messages
Re: safe to delete elements of array in foreach

Posted by Jon Slaughter on 05/18/07 15:40

"ZeldorBlat" <zeldorblat@gmail.com> wrote in message
news:1179501018.125313.63600@p77g2000hsh.googlegroups.com...
> On May 18, 11:05 am, "Jon Slaughter" <Jon_Slaugh...@Hotmail.com>
> wrote:
>> Is it safe to remove elements from an array that foreach is working on?
>> (normally this is not the case but not sure in php) If so is there an
>> efficient way to handle it? (I could add the indexes to a temp array and
>> delete afterwards if necessary but since I'm actually working in a nested
>> situation this could get a little messy. I guess I could set there values
>> to
>> null and remove them afterwards?
>>
>> Thanks,
>> Jon
>
> Why don't you try it and see what happens?
>

Um... cause I did... but that doesn't mean much. Just cause someone tries
something doesn't prove that it will always work like that...

got any more bright ideas?

Or is the question to hard for you?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация