function compare($url, &$rest, &$query_match) { $rest = null; $uri = new uri($url); $count1 = $this->count_path(); $count2 = $uri->count_path(); if (!$count1 || !$count2 || $this->protocol !== $uri->protocol || $this->host !== $uri->host) { return false; } $query_match = false; if (sizeof($this->_query_items) == sizeof($uri->_query_items)) { $query_match = true; foreach ($this->_query_items as $name => $value) { if (!isset($uri->query_items[$name]) || $uri->query_items[$name] != $this->_query_items[$name]) { $query_match = false; break; } } } for ($i = 0; $i < $count1 && $i < $count2; $i++) { if ($this->_path_elements[$i] != $uri->_path_elements[$i]) { return false; } } $rest = $count1 - $count2; return true; }