original_string: public function compare(moodle_url $url, $matchtype = URL_MATCH_EXACT) {
  
          $baseself = $this->out_omit_querystring();
          $baseother = $url->out_omit_querystring();
  
          // Append index.php if there is no specific file.
          if (substr($baseself, -1) == '/') {
              $baseself .= 'index.php';
          }
          if (substr($baseother, -1) == '/') {
              $baseother .= 'index.php';
          }
  
          // Compare the two base URLs.
          if ($baseself != $baseother) {
              return false;
          }
  
          if ($matchtype == URL_MATCH_BASE) {
              return true;
          }
  
          $urlparams = $url->params();
          foreach ($this->params() as $param => $value) {
              if ($param == 'sesskey') {
                  continue;
              }
              if (!array_key_exists($param, $urlparams) || $urlparams[$param] != $value) {
                  return false;
              }
          }
  
          if ($matchtype == URL_MATCH_PARAMS) {
              return true;
          }
  
          foreach ($urlparams as $param => $value) {
              if ($param == 'sesskey') {
                  continue;
              }
              if (!array_key_exists($param, $this->params()) || $this->param($param) != $value) {
                  return false;
              }
          }
  
          if ($url->anchor !== $this->anchor) {
              return false;
          }
  
          return true;
      }
code: public function compare(moodle_url $url, $matchtype = URL_MATCH_EXACT) {
  
          $baseself = $this->out_omit_querystring();
          $baseother = $url->out_omit_querystring();
  
          // Append index.php if there is no specific file.
          if (substr($baseself, -1) == '/') {
              $baseself .= 'index.php';
          }
          if (substr($baseother, -1) == '/') {
              $baseother .= 'index.php';
          }
  
          // Compare the two base URLs.
          if ($baseself != $baseother) {
              return false;
          }
  
          if ($matchtype == URL_MATCH_BASE) {
              return true;
          }
  
          $urlparams = $url->params();
          foreach ($this->params() as $param => $value) {
              if ($param == 'sesskey') {
                  continue;
              }
              if (!array_key_exists($param, $urlparams) || $urlparams[$param] != $value) {
                  return false;
              }
          }
  
          if ($matchtype == URL_MATCH_PARAMS) {
              return true;
          }
  
          foreach ($urlparams as $param => $value) {
              if ($param == 'sesskey') {
                  continue;
              }
              if (!array_key_exists($param, $this->params()) || $this->param($param) != $value) {
                  return false;
              }
          }
  
          if ($url->anchor !== $this->anchor) {
              return false;
          }
  
          return true;
      }
code_tokens: public function compare ( moodle_url $ url , $ matchtype = URL_MATCH_EXACT ) { $ baseself = $ this -> out_omit_querystring ( ) ; $ baseother = $ url -> out_omit_querystring ( ) ; // Append index.php if there is no specific file. if ( substr ( $ baseself , - 1 ) == '/' ) { $ baseself .= 'index.php' ; } if ( substr ( $ baseother , - 1 ) == '/' ) { $ baseother .= 'index.php' ; } // Compare the two base URLs. if ( $ baseself != $ baseother ) { return false ; } if ( $ matchtype == URL_MATCH_BASE ) { return true ; } $ urlparams = $ url -> params ( ) ; foreach ( $ this -> params ( ) as $ param => $ value ) { if ( $ param == 'sesskey' ) { continue ; } if ( ! array_key_exists ( $ param , $ urlparams ) || $ urlparams [ $ param ] != $ value ) { return false ; } } if ( $ matchtype == URL_MATCH_PARAMS ) { return true ; } foreach ( $ urlparams as $ param => $ value ) { if ( $ param == 'sesskey' ) { continue ; } if ( ! array_key_exists ( $ param , $ this -> params ( ) ) || $ this -> param ( $ param ) != $ value ) { return false ; } } if ( $ url -> anchor !== $ this -> anchor ) { return false ; } return true ; }
docstring: Compares this moodle_url with another.
  
  See documentation of constants for an explanation of the comparison flags.
  
  @param moodle_url $url The moodle_url object to compare
  @param int $matchtype The type of comparison (URL_MATCH_BASE, URL_MATCH_PARAMS, URL_MATCH_EXACT)
  @return bool
docstring_tokens: Compares this moodle_url with another .