By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,959 Members | 1,136 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,959 IT Pros & Developers. It's quick & easy.

Safe to delete elements of array in foreach

P: n/a
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

regards,
K. Kothandaraman
May 30 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On May 29, 9:37 pm, "kamal kothandaraman"
<kkothandara...@uolyahoo.orgwrote:
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

regards,
K. Kothandaraman
There was a very long thread about this not too long ago:

<http://groups.google.com/group/comp....se_frm/thread/
32287d3d8b815c33/b6841ec774f894f9>

May 30 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.