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