In a newly constructed class, I have a method that I want to use to remove any item object where "0 == $item->qty". The item objects are held in an array of objects called "products":Why will the method below NOT delete the item object with a quantity of zero?PHP Code:$this->products[$itemid]
PHP Code:function removeInvalidItems ()
{
foreach ( $this->products as $id)
{
if ( 0 == $id->qty )
{
unset ( $this->$id );
}
}
}




Bookmarks