Sep 122011
How to remove object from array inside foreach loop?
Answer:
In PHP, to remove object (e.g. with the key = foo in the following example) from array inside foreach loop, you can try:
<?php
foreach($array as $key=> $value) {
if ($key == "foo") {
unset($array[$key]);
}
}