Issue is caused by the array pointer being left at the end of the array after the function iterates through the array.
Fix is to reset the array at the end of the function: function RemoveTab($TabUrl) { while (list($Key, $Tab) = each($this->Tabs)) { if ($Tab['Url'] == $TabUrl) unset ($this->Tabs[$Key]); } reset($this->Tabs); }