private function isOpera()
  {
    $is = false;
    // The 'Opera/x.xx' stopped at 9.80, then the version went into the 'Version/x.x.x' format.
    if ( preg_match("/(Opera)\/9.80.*Version\/((\d+)\.(\d+)(?:\.(\d+))?)/", $this->ua, $matches) )
    {
      $is = true;
      $version = $matches[ 2 ];
      $major = $matches[ 3 ];
      $minor = $matches[ 4 ];
    }
    // Earlier versions had the version in 'Opera/x.xx' format.
    elseif ( preg_match( "/Opera (([0-9]+)\.?([0-9]*))/", $this->ua, $matches ) )
    {
      $is = true;
      $version = $matches[ 1 ];
      $major = $matches[ 2 ];
      $minor = $matches[ 3 ];
    }
    // Some versions of Opera Mobile look like this.  Luckily it's got OPR in the string or we'd think it was Safari.
    elseif ( preg_match( "/(?:Mobile Safari).*(OPR)\/(\d+)\.(\d+)\.(\d+)/", $this->ua, $matches ) )
    {
      $is = true;
      $version = $matches[ 2 ];
      $major = $matches[ 3 ];
      $minor = $matches[ 4 ];
    }
    // Opera version 15 was a freak UA, looking like Chrome, but with OPR in the string.
    elseif ( preg_match( "/(?:Chrome).*(OPR)\/(\d+)\.(\d+)\.(\d+)/", $this->ua, $matches ) )
    {
      $is = true;
      $version = $matches[ 2 ];
      $major = $matches[ 3 ];
      $minor = $matches[ 4 ];
    }

    if ( $is && isset( $version, $major, $minor ) )
    {
      $this->browser = "opera";
      $this->version = $version;
      $this->major = $major;
      $this->minor = $minor;

      return true;
    }

    return false;
  }
private function isOpera()
  {
    $is = false;
    // The 'Opera/x.xx' stopped at 9.80, then the version went into the 'Version/x.x.x' format.
    if ( preg_match("/(Opera)\/9.80.*Version\/((\d+)\.(\d+)(?:\.(\d+))?)/", $this->ua, $matches) )
    {
      $is = true;
      $version = $matches[ 2 ];
      $major = $matches[ 3 ];
      $minor = $matches[ 4 ];
    }
    // Earlier versions had the version in 'Opera/x.xx' format.
    elseif ( preg_match( "/Opera (([0-9]+)\.?([0-9]*))/", $this->ua, $matches ) )
    {
      $is = true;
      $version = $matches[ 1 ];
      $major = $matches[ 2 ];
      $minor = $matches[ 3 ];
    }
    // Some versions of Opera Mobile look like this.  Luckily it's got OPR in the string or we'd think it was Safari.
    elseif ( preg_match( "/(?:Mobile Safari).*(OPR)\/(\d+)\.(\d+)\.(\d+)/", $this->ua, $matches ) )
    {
      $is = true;
      $version = $matches[ 2 ];
      $major = $matches[ 3 ];
      $minor = $matches[ 4 ];
    }
    // Opera version 15 was a freak UA, looking like Chrome, but with OPR in the string.
    elseif ( preg_match( "/(?:Chrome).*(OPR)\/(\d+)\.(\d+)\.(\d+)/", $this->ua, $matches ) )
    {
      $is = true;
      $version = $matches[ 2 ];
      $major = $matches[ 3 ];
      $minor = $matches[ 4 ];
    }

    if ( $is && isset( $version, $major, $minor ) )
    {
      $this->browser = "opera";
      $this->version = $version;
      $this->major = $major;
      $this->minor = $minor;

      return true;
    }

    return false;
  }
private function isOpera ( ) { $ is = false ; // The 'Opera/x.xx' stopped at 9.80, then the version went into the 'Version/x.x.x' format. if ( preg_match ( "/(Opera)\/9.80.*Version\/((\d+)\.(\d+)(?:\.(\d+))?)/" , $ this -> ua , $ matches ) ) { $ is = true ; $ version = $ matches [ 2 ] ; $ major = $ matches [ 3 ] ; $ minor = $ matches [ 4 ] ; } // Earlier versions had the version in 'Opera/x.xx' format. elseif ( preg_match ( "/Opera (([0-9]+)\.?([0-9]*))/" , $ this -> ua , $ matches ) ) { $ is = true ; $ version = $ matches [ 1 ] ; $ major = $ matches [ 2 ] ; $ minor = $ matches [ 3 ] ; } // Some versions of Opera Mobile look like this.  Luckily it's got OPR in the string or we'd think it was Safari. elseif ( preg_match ( "/(?:Mobile Safari).*(OPR)\/(\d+)\.(\d+)\.(\d+)/" , $ this -> ua , $ matches ) ) { $ is = true ; $ version = $ matches [ 2 ] ; $ major = $ matches [ 3 ] ; $ minor = $ matches [ 4 ] ; } // Opera version 15 was a freak UA, looking like Chrome, but with OPR in the string. elseif ( preg_match ( "/(?:Chrome).*(OPR)\/(\d+)\.(\d+)\.(\d+)/" , $ this -> ua , $ matches ) ) { $ is = true ; $ version = $ matches [ 2 ] ; $ major = $ matches [ 3 ] ; $ minor = $ matches [ 4 ] ; } if ( $ is && isset ( $ version , $ major , $ minor ) ) { $ this -> browser = "opera" ; $ this -> version = $ version ; $ this -> major = $ major ; $ this -> minor = $ minor ; return true ; } return false ; }
Determines if a browser is Opera by the user agent string.

@return bool
Determines if a browser is Opera by the user agent string .