/** * compare 2 collections * @return bool */ public function compare(abs_collection $subj) { $subj->rewind(); while ($item = $subj->next()) { if (!(($tmp = $this->get_element_by_id($item->id)) && $tmp->get_data() == $item->get_data())) { return false; } } if ($subj->count() != $this->count()) { return false; } // passed return true; }