Menu

## BrowserDetection
in package

BrowserDetection.php : 169

The BrowserDetection class facilitates the identification of the user's environment such as Web browser, version, platform and device type.

Typical usage:

    $browser = new Wolfcast\BrowserDetection();
    if ($browser->getName() == Wolfcast\BrowserDetection::BROWSER_FIREFOX &&
        $browser->compareVersions($browser->getVersion(), '5.0') >= 0) {
        echo 'You are using FireFox version 5 or greater.';
    }

The class is a rewrite of Chris Schuld's Browser class version 1.9 which is mostly unmaintained since August 20th, 2010. Chris' class was based on the original work from Gary White.

Updates:

2025-03-23: Version 2.9.9

- Added macOS Sequoia detection for browsers that still correctly report the macOS version.

2024-04-21: Version 2.9.8

- Added macOS Sonoma and macOS Ventura detection. Note that all the majors Web browsers have reported macOS Catalina since 2021 for any macOS 11+ versions. See the documentation of macVerToStr() for more details.
- Improved the library documentation when detecting Windows version names since Windows 11 is always reported as Windows 10. See windowsNTVerToStr() for more details.
- Updated HTML documentation of the library to the latest version of phpDocumentor.

2022-09-20: Version 2.9.7

- Changed licensing to dual licensing: MIT or LGPL-3.0-only. This has no impact on existing users. You can continue under the previous license or switch to MIT.

2022-05-01: Version 2.9.6

- Added support for Chrome OS.
- Added support for macOS Monterey and macOS Big Sur.
- Now correctly detects AArch64 as 64-bit.
- Added support for PHP 8.
- Tested with latest Web Browsers and platforms.

2020-02-02: Version 2.9.5

- WARNING! Breaking change: complete rework of robots detection. Now robot name and version is detected in addition of browser name and version. Use getRobotName() and getRobotVersion() when isRobot() is true.
- WARNING! Breaking change: due to robots detection rework the following methods signatures has changed (isRobot parameter removed): addCustomBrowserDetection(), checkSimpleBrowserUA(), checkBrowserUAWithVersion().
- Added possibility to support new robots with addCustomRobotDetection().
- Added support for the new Microsoft Edge based on Chromium.
- Added version names for Android 10 and later (Google no longer use candy names for new versions).
- Added macOS Catalina detection.
- Added Windows Server 2019 detection (Windows Server 2016 can be no longer detected due to the fact that they both use the same version number and that the build is not included in the user agent).

2019-03-27: Version 2.9.3

- Fixed Edge detection on Android.
- Added Android Q detection.
- Now filtering superglobals.

2019-02-28: Version 2.9.2

- Fixed Opera detection.

2018-08-23: Version 2.9.1

- Fixed Chrome detection under iOS.
- Added Android Pie detection.
- Added macOS Mojave detection.

2018-07-15: Version 2.9.0

- WARNING! Breaking change: new Wolfcast namespace. Use new Wolfcast\BrowserDetection().
- iPad, iPhone and iPod are all under iOS now.
- Added Android Oreo detection.
- Added macOS High Sierra detection.
- Added UC Browser detection.
- Improved regular expressions (even less false positives).
- Removed AOL detection.
- Removed the following Web browsers detection: Amaya, Galeon, NetPositive, OmniWeb, Vivaldi detection (use addCustomBrowserDetection()).
- Removed the following legacy platforms detection: BeOS, OS/2, SunOS (use addCustomPlatformDetection()).

2016-11-28: Version 2.5.1

- Better detection of 64-bit platforms.

2016-08-19: Version 2.5.0

- Platform version and platform version name are now supported for Mac.
- Fixed platform version name for Android.

2016-08-02: Version 2.4.0

- Platform version and platform version name are now supported for Android.
- Added support for the Samsung Internet browser.
- Added support for the Vivaldi browser.
- Better support for legacy Windows versions.

2016-02-11: Version 2.3.0

- WARNING! Breaking change: public method getBrowser() is renamed to getName().
- WARNING! Breaking change: changed the compareVersions() return values to be more in line with other libraries.
- You can now get the exact platform version (name or version numbers) on which the browser is run on with getPlatformVersion(). Only working with Windows operating systems at the moment.
- You can now determine if the browser is executed from a 64-bit platform with is64bitPlatform().
- Better detection of mobile platform for Googlebot.

2016-01-04: Version 2.2.0

- Added support for Microsoft Edge.

2014-12-30: Version 2.1.2

- Better detection of Opera.

2014-07-11: Version 2.1.1

- Better detection of mobile devices and platforms.

2014-06-04: Version 2.1.0

- Added support for IE 11+.

2013-05-27: Version 2.0.0 which is (almost) a complete rewrite based on Chris Schuld's Browser class version 1.9 plus changes below.

- Added support for Opera Mobile
- Added support for the Windows Phone (formerly Windows Mobile) platform
- Added support for BlackBerry Tablet OS and BlackBerry 10
- Added support for the Symbian platform
- Added support for Bingbot
- Added support for the Yahoo! Multimedia crawler
- Removed iPhone/iPad/iPod browsers since there are not browsers but platforms - test them with getPlatform()
- Removed support for Shiretoko (Firefox 3.5 alpha/beta) and MSN Browser
- Merged Nokia and Nokia S60
- Updated some deprecated browser names
- Many public methods are now protected
- Documentation updated

2010-07-04:

- Added detection of IE compatibility view - test with getIECompatibilityView()
- Added support for all (deprecated) Netscape versions
- Added support for Safari < 3.0
- Better Firefox version parsing
- Better Opera version parsing
- Better Mozilla detection

##### Tags

version
  2.9.9
last-modified

  March 23, 2025

author

  Alexandre Valiquette, Chris Schuld, Gary White

copyright

  Copyright (c) 2025, Wolfcast

license

  https://spdx.org/licenses/GPL-3.0-only.html

license

  https://spdx.org/licenses/MIT.html

link
  https://wolfcast.com/
link
  https://wolfcast.com/open-source/browser-detection/tutorial.php
link
  https://chrisschuld.com/

### Table of Contents

#### Constants

BROWSER_ANDROID = 'Android'
BROWSER_BLACKBERRY = 'BlackBerry'
BROWSER_CHROME = 'Chrome'
BROWSER_EDGE = 'Edge'
BROWSER_FIREBIRD = 'Firebird'
BROWSER_FIREFOX = 'Firefox'
BROWSER_ICAB = 'iCab'
BROWSER_ICECAT = 'GNU IceCat'
BROWSER_ICEWEASEL = 'GNU IceWeasel'
BROWSER_IE = 'Internet Explorer'
BROWSER_IE_MOBILE = 'Internet Explorer Mobile'
BROWSER_KONQUEROR = 'Konqueror'
BROWSER_LYNX = 'Lynx'
BROWSER_MOZILLA = 'Mozilla'
BROWSER_MSNTV = 'MSN TV'
BROWSER_NETSCAPE = 'Netscape'
BROWSER_NOKIA = 'Nokia Browser'
BROWSER_OPERA = 'Opera'
BROWSER_OPERA_MINI = 'Opera Mini'
BROWSER_OPERA_MOBILE = 'Opera Mobile'
BROWSER_PHOENIX = 'Phoenix'
BROWSER_SAFARI = 'Safari'
BROWSER_SAMSUNG = 'Samsung Internet'
BROWSER_TABLET_OS = 'BlackBerry Tablet OS'
BROWSER_UC = 'UC Browser'
BROWSER_UNKNOWN = 'unknown'
PLATFORM_ANDROID = 'Android'
PLATFORM_BLACKBERRY = 'BlackBerry'
PLATFORM_CHROME_OS = 'Chrome OS'
PLATFORM_FREEBSD = 'FreeBSD'
PLATFORM_IOS = 'iOS'
PLATFORM_LINUX = 'Linux'
PLATFORM_MACINTOSH = 'Macintosh'
PLATFORM_NETBSD = 'NetBSD'
PLATFORM_NOKIA = 'Nokia'
PLATFORM_OPENBSD = 'OpenBSD'
PLATFORM_OPENSOLARIS = 'OpenSolaris'
PLATFORM_SYMBIAN = 'Symbian'
PLATFORM_UNKNOWN = 'unknown'
PLATFORM_VERSION_UNKNOWN = 'unknown'
PLATFORM_WINDOWS = 'Windows'
PLATFORM_WINDOWS_CE = 'Windows CE'
PLATFORM_WINDOWS_PHONE = 'Windows Phone'
ROBOT_BINGBOT = 'Bingbot'
ROBOT_GOOGLEBOT = 'Googlebot'
ROBOT_MSNBOT = 'MSNBot'
ROBOT_SLURP = 'Yahoo! Slurp'
ROBOT_UNKNOWN = ''
ROBOT_VERSION_UNKNOWN = ''
ROBOT_W3CVALIDATOR = 'W3C Validator'
ROBOT_YAHOO_MM = 'Yahoo! Multimedia'
VERSION_UNKNOWN = 'unknown'
  Version unknown constant.

#### Properties

$_agent : string
$_browserName : string
$_compatibilityViewName : string
$_compatibilityViewVer : string
$_customBrowserDetection : array<string|int, mixed>
$_customPlatformDetection : array<string|int, mixed>
$_customRobotDetection : array<string|int, mixed>
$_is64bit : bool
$_isMobile : bool
$_isRobot : bool
$_platform : string
$_platformVersion : string
$_robotName : string
$_robotVersion : string
$_version : string

#### Methods

__construct() : mixed
  BrowserDetection class constructor.
__toString() : string
  Determine how the class will react when it is treated like a string.
addCustomBrowserDetection() : bool
  Dynamically add support for a new Web browser.
addCustomPlatformDetection() : bool
  Dynamically add support for a new platform.
addCustomRobotDetection() : bool
  Dynamically add support for a new robot.
compareVersions() : int
  Compare two version number strings.
getIECompatibilityView() : mixed
  Get the name and version of the browser emulated in the compatibility view mode (if any). Since Internet Explorer 8, IE can be put in compatibility mode to make websites that were created for older browsers, especially IE 6 and 7, look better in IE 8+ which renders web pages closer to the standards and thus differently from those older versions of IE.
getLibVersion() : string
  Return the BrowserDetection class version.
getName() : string
  Get the name of the browser. All of the return values are class constants. You can compare them like this: $myBrowserInstance->getName() == BrowserDetection::BROWSER_FIREFOX.
getPlatform() : string
  Get the name of the platform family on which the browser is run on (such as Windows, Apple, etc.). All of the return values are class constants. You can compare them like this: $myBrowserInstance->getPlatform() == BrowserDetection::PLATFORM_ANDROID.
getPlatformVersion() : string
  Get the platform version on which the browser is run on. It can be returned as a string number like 'NT 6.3' or as a name like 'Windows 8.1'. When returning version string numbers for Windows NT OS families the number is prefixed by 'NT ' to differentiate from older Windows 3.x & 9x release. At the moment only the Windows and Android operating systems are supported.
getRobotName() : string
  Get the name of the robot. All of the return values are class constants. You can compare them like this: $myBrowserInstance->getRobotName() == BrowserDetection::ROBOT_GOOGLEBOT.
getRobotVersion() : string
  Get the version of the robot.
getUserAgent() : string
  Get the user agent value used by the class to determine the browser details.
getVersion() : string
  Get the version of the browser.
is64bitPlatform() : bool
  Determine if the browser is executed from a 64-bit platform. Keep in mind that not all platforms/browsers report this and the result may not always be accurate.
isChromeFrame() : bool
  Determine if the browser runs Google Chrome Frame (it's a plug-in designed for Internet Explorer 6+ based on the open-source Chromium project - it's like a Chrome browser within IE).
isInIECompatibilityView() : bool
  Determine if the browser is in compatibility view or not. Since Internet Explorer 8, IE can be put in compatibility mode to make websites that were created for older browsers, especially IE 6 and 7, look better in IE 8+ which renders web pages closer to the standards and thus differently from those older versions of IE.
isMobile() : bool
  Determine if the browser is from a mobile device or not.
isRobot() : bool
  Determine if the browser is a robot (Googlebot, Bingbot, Yahoo! Slurp...) or not.
removeCustomBrowserDetection() : bool
  Remove support for a previously added Web browser.
removeCustomPlatformDetection() : bool
  Remove support for a previously added platform.
removeCustomRobotDetection() : bool
  Remove support for a previously added robot.
setUserAgent() : mixed
  Set the user agent to use with the class.
androidVerToStr() : string
  Convert the Android version numbers to the operating system name. For instance '1.6' returns 'Donut'.
checkBrowser() : bool
  Determine what is the browser used by the user.
checkBrowserAndroid() : bool
  Determine if the browser is the Android browser (based on the WebKit layout engine and coupled with Chrome's JavaScript engine) or not.
checkBrowserBlackBerry() : bool
  Determine if the browser is the BlackBerry browser or not.
checkBrowserChrome() : bool
  Determine if the browser is Chrome or not.
checkBrowserCustom() : bool
  Determine if the browser is among the custom browser rules or not. Rules are checked in the order they were added.
checkBrowserEdge() : bool
  Determine if the browser is Edge or not.
checkBrowserFirebird() : bool
  Determine if the browser is Firebird or not. Firebird was the name of Firefox from version 0.6 to 0.7.1.
checkBrowserFirefox() : bool
  Determine if the browser is Firefox or not.
checkBrowserIcab() : bool
  Determine if the browser is iCab or not.
checkBrowserIceCat() : bool
  Determine if the browser is GNU IceCat (formerly known as GNU IceWeasel) or not.
checkBrowserIceWeasel() : bool
  Determine if the browser is GNU IceWeasel (now know as GNU IceCat) or not.
checkBrowserInternetExplorer() : bool
  Determine if the browser is Internet Explorer or not.
checkBrowserKonqueror() : bool
  Determine if the browser is Konqueror or not.
checkBrowserLynx() : bool
  Determine if the browser is Lynx or not. It is the oldest web browser currently in general use and development.
checkBrowserMozilla() : bool
  Determine if the browser is Mozilla or not.
checkBrowserMsnTv() : bool
  Determine if the browser is MSN TV (formerly WebTV) or not.
checkBrowserNetscape() : bool
  Determine if the browser is Netscape or not. Official support for this browser ended on March 1st, 2008.
checkBrowserNokia() : bool
  Determine if the browser is a Nokia browser or not.
checkBrowserOpera() : bool
  Determine if the browser is Opera or not.
checkBrowserPhoenix() : bool
  Determine if the browser is Phoenix or not. Phoenix was the name of Firefox from version 0.1 to 0.5.
checkBrowserSafari() : bool
  Determine if the browser is Safari or not.
checkBrowserSamsung() : bool
  Determine if the browser is the Samsung Internet browser or not.
checkBrowserUAWithVersion() : bool
  Test the user agent for a specific browser that use a "Version" string (like Safari and Opera). The user agent should look like: "Version/1.0 Browser name/123.456" or "Browser name/123.456 Version/1.0".
checkBrowserUC() : bool
  Determine if the browser is UC Browser or not.
checkPlatform() : mixed
  Determine the user's platform.
checkPlatformCustom() : bool
  Determine if the platform is among the custom platform rules or not. Rules are checked in the order they were added.
checkPlatformVersion() : mixed
  Determine the user's platform version.
checkRobot() : mixed
  Determine if it's a robot crawling the page and find it's name and version.
checkRobotBingbot() : bool
  Determine if the robot is the Bingbot crawler or not.
checkRobotCustom() : bool
  Determine if the robot is among the custom robot rules or not. Rules are checked in the order they were added.
checkRobotGooglebot() : bool
  Determine if the robot is the Googlebot crawler or not.
checkRobotMsnBot() : bool
  Determine if the robot is the MSNBot crawler or not. In October 2010 it was replaced by the Bingbot robot.
checkRobotSlurp() : bool
  Determine if the robot is the Yahoo! Slurp crawler or not.
checkRobotW3CValidator() : bool
  Determine if the robot is the W3C Validator or not.
checkRobotYahooMultimedia() : bool
  Determine if the robot is the Yahoo! multimedia crawler or not.
checkSimpleBrowserUA() : bool
  Test the user agent for a specific browser where the browser name is immediately followed by the version number.
checkSimpleRobot() : bool
  Test the user agent for a specific robot where the robot name is immediately followed by the version number.
cleanVersion() : string
  Clean a version string from unwanted characters.
containString() : bool
  Find if one or more substring is contained in a string.
detect() : mixed
  Detect the user environment from the details in the user agent string.
findAndGetVersion() : bool
  Test the user agent for a specific browser and extract it's version.
iOSVerToStr() : string
  Convert the iOS version numbers to the operating system name. For instance '2.0' returns 'iPhone OS 2.0'.
macVerToStr() : string
  Convert the macOS version numbers to the operating system name. For instance '10.7' returns 'Mac OS X Lion'.
parseInt() : int
  Get the integer value of a string variable.
reset() : mixed
  Reset all the properties of the class.
safariBuildToSafariVer() : string
  Convert a Safari build number to a Safari version number.
set64bit() : mixed
  Set if the browser is executed from a 64-bit platform.
setBrowser() : mixed
  Set the name of the browser.
setMobile() : mixed
  Set the browser to be from a mobile device or not.
setPlatform() : mixed
  Set the platform on which the browser is on.
setPlatformVersion() : mixed
  Set the platform version on which the browser is on.
setRobot() : mixed
  Set the browser to be a robot (crawler) or not.
setRobotName() : mixed
  Set the name of the robot.
setRobotVersion() : mixed
  Set the version of the robot.
setVersion() : mixed
  Set the version of the browser.
webKitBuildToSafariVer() : string
  Convert a WebKit build number to a Safari version number.
windowsNTVerToStr() : string
  Convert the Windows NT family version numbers to the operating system name. For instance '5.1' returns 'Windows XP'.
windowsVerToStr() : string
  Convert the Windows 3.x & 9x family version numbers to the operating system name. For instance '4.10.1998' returns 'Windows 98'.
wordPos() : mixed
  Find the position of the first occurrence of a word in a string.

### Constants

#### BROWSER_ANDROID

BrowserDetection.php : 175
`public mixed BROWSER_ANDROID = 'Android'`

#### BROWSER_BLACKBERRY

BrowserDetection.php : 176
`public mixed BROWSER_BLACKBERRY = 'BlackBerry'`

#### BROWSER_CHROME

BrowserDetection.php : 177
`public mixed BROWSER_CHROME = 'Chrome'`

#### BROWSER_EDGE

BrowserDetection.php : 178
`public mixed BROWSER_EDGE = 'Edge'`

#### BROWSER_FIREBIRD

BrowserDetection.php : 179
`public mixed BROWSER_FIREBIRD = 'Firebird'`

#### BROWSER_FIREFOX

BrowserDetection.php : 180
`public mixed BROWSER_FIREFOX = 'Firefox'`

#### BROWSER_ICAB

BrowserDetection.php : 181
`public mixed BROWSER_ICAB = 'iCab'`

#### BROWSER_ICECAT

BrowserDetection.php : 182
`public mixed BROWSER_ICECAT = 'GNU IceCat'`

#### BROWSER_ICEWEASEL

BrowserDetection.php : 183
`public mixed BROWSER_ICEWEASEL = 'GNU IceWeasel'`

#### BROWSER_IE

BrowserDetection.php : 184
`public mixed BROWSER_IE = 'Internet Explorer'`

#### BROWSER_IE_MOBILE

BrowserDetection.php : 185
`public mixed BROWSER_IE_MOBILE = 'Internet Explorer Mobile'`

#### BROWSER_KONQUEROR

BrowserDetection.php : 186
`public mixed BROWSER_KONQUEROR = 'Konqueror'`

#### BROWSER_LYNX

BrowserDetection.php : 187
`public mixed BROWSER_LYNX = 'Lynx'`

#### BROWSER_MOZILLA

BrowserDetection.php : 188
`public mixed BROWSER_MOZILLA = 'Mozilla'`

#### BROWSER_MSNTV

BrowserDetection.php : 189
`public mixed BROWSER_MSNTV = 'MSN TV'`

#### BROWSER_NETSCAPE

BrowserDetection.php : 190
`public mixed BROWSER_NETSCAPE = 'Netscape'`

#### BROWSER_NOKIA

BrowserDetection.php : 191
`public mixed BROWSER_NOKIA = 'Nokia Browser'`

#### BROWSER_OPERA

BrowserDetection.php : 192
`public mixed BROWSER_OPERA = 'Opera'`

#### BROWSER_OPERA_MINI

BrowserDetection.php : 193
`public mixed BROWSER_OPERA_MINI = 'Opera Mini'`

#### BROWSER_OPERA_MOBILE

BrowserDetection.php : 194
`public mixed BROWSER_OPERA_MOBILE = 'Opera Mobile'`

#### BROWSER_PHOENIX

BrowserDetection.php : 195
`public mixed BROWSER_PHOENIX = 'Phoenix'`

#### BROWSER_SAFARI

BrowserDetection.php : 196
`public mixed BROWSER_SAFARI = 'Safari'`

#### BROWSER_SAMSUNG

BrowserDetection.php : 197
`public mixed BROWSER_SAMSUNG = 'Samsung Internet'`

#### BROWSER_TABLET_OS

BrowserDetection.php : 198
`public mixed BROWSER_TABLET_OS = 'BlackBerry Tablet OS'`

#### BROWSER_UC

BrowserDetection.php : 199
`public mixed BROWSER_UC = 'UC Browser'`

#### BROWSER_UNKNOWN

BrowserDetection.php : 200
`public mixed BROWSER_UNKNOWN = 'unknown'`

#### PLATFORM_ANDROID

BrowserDetection.php : 206
`public mixed PLATFORM_ANDROID = 'Android'`

#### PLATFORM_BLACKBERRY

BrowserDetection.php : 207
`public mixed PLATFORM_BLACKBERRY = 'BlackBerry'`

#### PLATFORM_CHROME_OS

BrowserDetection.php : 208
`public mixed PLATFORM_CHROME_OS = 'Chrome OS'`

#### PLATFORM_FREEBSD

BrowserDetection.php : 209
`public mixed PLATFORM_FREEBSD = 'FreeBSD'`

#### PLATFORM_IOS

BrowserDetection.php : 210
`public mixed PLATFORM_IOS = 'iOS'`

#### PLATFORM_LINUX

BrowserDetection.php : 211
`public mixed PLATFORM_LINUX = 'Linux'`

#### PLATFORM_MACINTOSH

BrowserDetection.php : 212
`public mixed PLATFORM_MACINTOSH = 'Macintosh'`

#### PLATFORM_NETBSD

BrowserDetection.php : 213
`public mixed PLATFORM_NETBSD = 'NetBSD'`

#### PLATFORM_NOKIA

BrowserDetection.php : 214
`public mixed PLATFORM_NOKIA = 'Nokia'`

#### PLATFORM_OPENBSD

BrowserDetection.php : 215
`public mixed PLATFORM_OPENBSD = 'OpenBSD'`

#### PLATFORM_OPENSOLARIS

BrowserDetection.php : 216
`public mixed PLATFORM_OPENSOLARIS = 'OpenSolaris'`

#### PLATFORM_SYMBIAN

BrowserDetection.php : 217
`public mixed PLATFORM_SYMBIAN = 'Symbian'`

#### PLATFORM_UNKNOWN

BrowserDetection.php : 218
`public mixed PLATFORM_UNKNOWN = 'unknown'`

#### PLATFORM_VERSION_UNKNOWN

BrowserDetection.php : 219
`public mixed PLATFORM_VERSION_UNKNOWN = 'unknown'`

#### PLATFORM_WINDOWS

BrowserDetection.php : 220
`public mixed PLATFORM_WINDOWS = 'Windows'`

#### PLATFORM_WINDOWS_CE

BrowserDetection.php : 221
`public mixed PLATFORM_WINDOWS_CE = 'Windows CE'`

#### PLATFORM_WINDOWS_PHONE

BrowserDetection.php : 222
`public mixed PLATFORM_WINDOWS_PHONE = 'Windows Phone'`

#### ROBOT_BINGBOT

BrowserDetection.php : 228
`public mixed ROBOT_BINGBOT = 'Bingbot'`

#### ROBOT_GOOGLEBOT

BrowserDetection.php : 229
`public mixed ROBOT_GOOGLEBOT = 'Googlebot'`

#### ROBOT_MSNBOT

BrowserDetection.php : 230
`public mixed ROBOT_MSNBOT = 'MSNBot'`

#### ROBOT_SLURP

BrowserDetection.php : 231
`public mixed ROBOT_SLURP = 'Yahoo! Slurp'`

#### ROBOT_UNKNOWN

BrowserDetection.php : 232
`public mixed ROBOT_UNKNOWN = ''`

#### ROBOT_VERSION_UNKNOWN

BrowserDetection.php : 233
`public mixed ROBOT_VERSION_UNKNOWN = ''`

#### ROBOT_W3CVALIDATOR

BrowserDetection.php : 234
`public mixed ROBOT_W3CVALIDATOR = 'W3C Validator'`

#### ROBOT_YAHOO_MM

BrowserDetection.php : 235
`public mixed ROBOT_YAHOO_MM = 'Yahoo! Multimedia'`

#### VERSION_UNKNOWN

BrowserDetection.php : 241

Version unknown constant.

`public mixed VERSION_UNKNOWN = 'unknown'`

### Properties

#### $_agent

BrowserDetection.php : 248
`private string $_agent = ''`

##### Tags

access

  private

#### $_browserName

BrowserDetection.php : 254
`private string $_browserName = ''`

##### Tags

access

  private

#### $_compatibilityViewName

BrowserDetection.php : 260
`private string $_compatibilityViewName = ''`

##### Tags

access

  private

#### $_compatibilityViewVer

BrowserDetection.php : 266
`private string $_compatibilityViewVer = ''`

##### Tags

access

  private

#### $_customBrowserDetection

BrowserDetection.php : 272
`private array<string|int, mixed> $_customBrowserDetection = array()`

##### Tags

access

  private

#### $_customPlatformDetection

BrowserDetection.php : 278
`private array<string|int, mixed> $_customPlatformDetection = array()`

##### Tags

access

  private

#### $_customRobotDetection

BrowserDetection.php : 284
`private array<string|int, mixed> $_customRobotDetection = array()`

##### Tags

access

  private

#### $_is64bit

BrowserDetection.php : 290
`private bool $_is64bit = false`

##### Tags

access

  private

#### $_isMobile

BrowserDetection.php : 296
`private bool $_isMobile = false`

##### Tags

access

  private

#### $_isRobot

BrowserDetection.php : 302
`private bool $_isRobot = false`

##### Tags

access

  private

#### $_platform

BrowserDetection.php : 308
`private string $_platform = ''`

##### Tags

access

  private

#### $_platformVersion

BrowserDetection.php : 314
`private string $_platformVersion = ''`

##### Tags

access

  private

#### $_robotName

BrowserDetection.php : 320
`private string $_robotName = ''`

##### Tags

access

  private

#### $_robotVersion

BrowserDetection.php : 326
`private string $_robotVersion = ''`

##### Tags

access

  private

#### $_version

BrowserDetection.php : 332
`private string $_version = ''`

##### Tags

access

  private

### Methods

#### __construct()

BrowserDetection.php : 343

BrowserDetection class constructor.

`public __construct([string $useragent = '' ]) : mixed`

##### Parameters

$useragent : string = ''

  (optional) The user agent to work with. Leave empty for the current user agent (contained in $_SERVER['HTTP_USER_AGENT']).

#### __toString()

BrowserDetection.php : 352

Determine how the class will react when it is treated like a string.

`public __toString() : string`

##### Return values

string —

Returns an HTML formatted string with a summary of the browser informations.

#### addCustomBrowserDetection()

BrowserDetection.php : 397

Dynamically add support for a new Web browser.

`public addCustomBrowserDetection(string $browserName[, mixed $uaNameToLookFor = '' ][, bool $isMobile = false ][, string $separator = '/' ][, bool $uaNameFindWords = true ]) : bool`

##### Parameters

$browserName : string

  The Web browser name (used for display).

$uaNameToLookFor : mixed = ''

  (optional) The string (or array of strings) representing the browser name to find in the user agent. If omitted, $browserName will be used.

$isMobile : bool = false

  (optional) Determines if the browser is from a mobile device.

$separator : string = '/'

  (optional) The separator string used to split the browser name and the version number in the user agent.

$uaNameFindWords : bool = true

  (optional) Determines if the browser name to find should match a word instead of a part of a word. For example "Bar" would not be found in "FooBar" when true but would be found in "Foo Bar". When set to false, the browser name can be found anywhere in the user agent string.

##### Tags

see
  removeCustomBrowserDetection()

##### Return values

bool —

Returns true if the custom rule has been added, false otherwise.

#### addCustomPlatformDetection()

BrowserDetection.php : 424

Dynamically add support for a new platform.

`public addCustomPlatformDetection(string $platformName[, mixed $platformNameToLookFor = '' ][, bool $isMobile = false ][, bool $uaNameFindWords = true ]) : bool`

##### Parameters

$platformName : string

  The platform name (used for display).

$platformNameToLookFor : mixed = ''

  (optional) The string (or array of strings) representing the platform name to find in the user agent. If omitted, $platformName will be used.

$isMobile : bool = false

  (optional) Determines if the platform is from a mobile device.

$uaNameFindWords : bool = true

  (optional) Determines if the platform name to find should match a word instead of a part of a word. For example "Bar" would not be found in "FooBar" when true but would be found in "Foo Bar".

##### Tags

see
  removeCustomPlatformDetection()

##### Return values

bool —

Returns true if the custom rule has been added, false otherwise.

#### addCustomRobotDetection()

BrowserDetection.php : 455

Dynamically add support for a new robot.

`public addCustomRobotDetection(string $robotName[, mixed $uaNameToLookFor = '' ][, bool $isMobile = false ][, string $separator = '/' ][, bool $uaNameFindWords = true ]) : bool`

##### Parameters

$robotName : string

  The robot name (used for display).

$uaNameToLookFor : mixed = ''

  (optional) The string (or array of strings) representing the robot name to find in the user agent. If omitted, $robotName will be used.

$isMobile : bool = false

  (optional) Determines if the robot should be considered as mobile or not.

$separator : string = '/'

  (optional) The separator string used to split the robot name and the version number in the user agent.

$uaNameFindWords : bool = true

  (optional) Determines if the robot name to find should match a word instead of a part of a word. For example "Bar" would not be found in "FooBar" when true but would be found in "Foo Bar". When set to false, the robot name can be found anywhere in the user agent string.

##### Tags

see
  removeCustomRobotDetection()

##### Return values

bool —

Returns true if the custom rule has been added, false otherwise.

#### compareVersions()

BrowserDetection.php : 478

Compare two version number strings.

`public compareVersions(string $sourceVer, string $compareVer) : int`

##### Parameters

$sourceVer : string

  The source version number.

$compareVer : string

  The version number to compare with the source version number.

##### Return values

int —

Returns -1 if $sourceVer < $compareVer, 0 if $sourceVer == $compareVer or 1 if $sourceVer > $compareVer.

#### getIECompatibilityView()

BrowserDetection.php : 525

Get the name and version of the browser emulated in the compatibility view mode (if any). Since Internet Explorer 8, IE can be put in compatibility mode to make websites that were created for older browsers, especially IE 6 and 7, look better in IE 8+ which renders web pages closer to the standards and thus differently from those older versions of IE.

`public getIECompatibilityView([bool $asArray = false ]) : mixed`

##### Parameters

$asArray : bool = false

  (optional) Determines if the return value must be an array (true) or a string (false).

##### Return values

mixed —

If a string was requested, the function returns the name and version of the browser emulated in the compatibility view mode or an empty string if the browser is not in compatibility view mode. If an array was requested, an array with the keys 'browser' and 'version' is returned.

#### getLibVersion()

BrowserDetection.php : 538

Return the BrowserDetection class version.

`public getLibVersion() : string`

##### Return values

string —

Returns the version as a sting with the #.#.# format.

#### getName()

BrowserDetection.php : 548

Get the name of the browser. All of the return values are class constants. You can compare them like this: $myBrowserInstance->getName() == BrowserDetection::BROWSER_FIREFOX.

`public getName() : string`

##### Return values

string —

Returns the name of the browser or BrowserDetection::BROWSER_UNKNOWN if unknown.

#### getPlatform()

BrowserDetection.php : 559

Get the name of the platform family on which the browser is run on (such as Windows, Apple, etc.). All of the return values are class constants. You can compare them like this: $myBrowserInstance->getPlatform() == BrowserDetection::PLATFORM_ANDROID.

`public getPlatform() : string`

##### Return values

string —

Returns the name of the platform or BrowserDetection::PLATFORM_UNKNOWN if unknown.

#### getPlatformVersion()

BrowserDetection.php : 577

Get the platform version on which the browser is run on. It can be returned as a string number like 'NT 6.3' or as a name like 'Windows 8.1'. When returning version string numbers for Windows NT OS families the number is prefixed by 'NT ' to differentiate from older Windows 3.x & 9x release. At the moment only the Windows and Android operating systems are supported.

`public getPlatformVersion([bool $returnVersionNumbers = false ][, bool $returnServerFlavor = false ]) : string`

##### Parameters

$returnVersionNumbers : bool = false

  (optional) Determines if the return value must be versions numbers as a string (true) or the version name (false).

$returnServerFlavor : bool = false

  (optional) Since some Windows NT versions have the same values, this flag determines if the Server flavor is returned or not. For instance Windows 8.1 and Windows Server 2012 R2 both use version 6.3. This parameter is only useful when testing for Windows.

##### Return values

string —

Returns the version name/version numbers of the platform or the constant PLATFORM_VERSION_UNKNOWN if unknown.

#### getRobotName()

BrowserDetection.php : 614

Get the name of the robot. All of the return values are class constants. You can compare them like this: $myBrowserInstance->getRobotName() == BrowserDetection::ROBOT_GOOGLEBOT.

`public getRobotName() : string`

##### Return values

string —

Returns the name of the robot or BrowserDetection::ROBOT_UNKNOWN if unknown.

#### getRobotVersion()

BrowserDetection.php : 623

Get the version of the robot.

`public getRobotVersion() : string`

##### Return values

string —

Returns the version of the robot or BrowserDetection::ROBOT_VERSION_UNKNOWN if unknown.

#### getUserAgent()

BrowserDetection.php : 632

Get the user agent value used by the class to determine the browser details.

`public getUserAgent() : string`

##### Return values

string —

The user agent string.

#### getVersion()

BrowserDetection.php : 641

Get the version of the browser.

`public getVersion() : string`

##### Return values

string —

Returns the version of the browser or BrowserDetection::VERSION_UNKNOWN if unknown.

#### is64bitPlatform()

BrowserDetection.php : 651

Determine if the browser is executed from a 64-bit platform. Keep in mind that not all platforms/browsers report this and the result may not always be accurate.

`public is64bitPlatform() : bool`

##### Return values

bool —

Returns true if the browser is executed from a 64-bit platform.

#### isChromeFrame()

BrowserDetection.php : 661

Determine if the browser runs Google Chrome Frame (it's a plug-in designed for Internet Explorer 6+ based on the open-source Chromium project - it's like a Chrome browser within IE).

`public isChromeFrame() : bool`

##### Return values

bool —

Returns true if the browser is using Google Chrome Frame, false otherwise.

#### isInIECompatibilityView()

BrowserDetection.php : 672

Determine if the browser is in compatibility view or not. Since Internet Explorer 8, IE can be put in compatibility mode to make websites that were created for older browsers, especially IE 6 and 7, look better in IE 8+ which renders web pages closer to the standards and thus differently from those older versions of IE.

`public isInIECompatibilityView() : bool`

##### Return values

bool —

Returns true if the browser is in compatibility view, false otherwise.

#### isMobile()

BrowserDetection.php : 681

Determine if the browser is from a mobile device or not.

`public isMobile() : bool`

##### Return values

bool —

Returns true if the browser is from a mobile device, false otherwise.

#### isRobot()

BrowserDetection.php : 690

Determine if the browser is a robot (Googlebot, Bingbot, Yahoo! Slurp...) or not.

`public isRobot() : bool`

##### Return values

bool —

Returns true if the browser is a robot, false otherwise.

#### removeCustomBrowserDetection()

BrowserDetection.php : 701

Remove support for a previously added Web browser.

`public removeCustomBrowserDetection(string $browserName) : bool`

##### Parameters

$browserName : string

  The Web browser name as used when added.

##### Tags

see
  addCustomBrowserDetection()

##### Return values

bool —

Returns true if the custom rule has been found and removed, false otherwise.

#### removeCustomPlatformDetection()

BrowserDetection.php : 717

Remove support for a previously added platform.

`public removeCustomPlatformDetection(string $platformName) : bool`

##### Parameters

$platformName : string

  The platform name as used when added.

##### Tags

see
  addCustomPlatformDetection()

##### Return values

bool —

Returns true if the custom rule has been found and removed, false otherwise.

#### removeCustomRobotDetection()

BrowserDetection.php : 733

Remove support for a previously added robot.

`public removeCustomRobotDetection(string $robotName) : bool`

##### Parameters

$robotName : string

  The robot name as used when added.

##### Tags

see
  addCustomRobotDetection()

##### Return values

bool —

Returns true if the custom rule has been found and removed, false otherwise.

#### setUserAgent()

BrowserDetection.php : 748

Set the user agent to use with the class.

`public setUserAgent([string $agentString = '' ]) : mixed`

##### Parameters

$agentString : string = ''

  (optional) The value of the user agent. If an empty string is sent (default), $_SERVER['HTTP_USER_AGENT'] will be used.

#### androidVerToStr()

BrowserDetection.php : 782

Convert the Android version numbers to the operating system name. For instance '1.6' returns 'Donut'.

`protected androidVerToStr(string $androidVer) : string`

##### Parameters

$androidVer : string

  The Android version numbers as a string.

##### Tags

access

  protected

##### Return values

string —

The operating system name or the constant PLATFORM_VERSION_UNKNOWN if nothing match the version numbers.

#### checkBrowser()

BrowserDetection.php : 1247

Determine what is the browser used by the user.

`protected checkBrowser() : bool`

##### Tags

access

  protected

##### Return values

bool —

Returns true if the browser has been identified, false otherwise.

#### checkBrowserAndroid()

BrowserDetection.php : 831

Determine if the browser is the Android browser (based on the WebKit layout engine and coupled with Chrome's JavaScript engine) or not.

`protected checkBrowserAndroid() : bool`

##### Tags

access

  protected

##### Return values

bool —

Returns true if the browser is the Android browser, false otherwise.

#### checkBrowserBlackBerry()

BrowserDetection.php : 843

Determine if the browser is the BlackBerry browser or not.

`protected checkBrowserBlackBerry() : bool`

##### Tags

access

  protected

link
  https://web.archive.org/web/20170328000854/http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/How-to-detect-the-BlackBerry-Browser/ta-p/559862

##### Return values

bool —

Returns true if the browser is the BlackBerry browser, false otherwise.

#### checkBrowserChrome()

BrowserDetection.php : 879

Determine if the browser is Chrome or not.

`protected checkBrowserChrome() : bool`

##### Tags

access

  protected

link
  https://www.google.com/chrome/

##### Return values

bool —

Returns true if the browser is Chrome, false otherwise.

#### checkBrowserCustom()

BrowserDetection.php : 890

Determine if the browser is among the custom browser rules or not. Rules are checked in the order they were added.

`protected checkBrowserCustom() : bool`

##### Tags

access

  protected

##### Return values

bool —

Returns true if we found the browser we were looking for in the custom rules, false otherwise.

#### checkBrowserEdge()

BrowserDetection.php : 909

Determine if the browser is Edge or not.

`protected checkBrowserEdge() : bool`

##### Tags

access

  protected

##### Return values

bool —

Returns true if the browser is Edge, false otherwise.

#### checkBrowserFirebird()

BrowserDetection.php : 919

Determine if the browser is Firebird or not. Firebird was the name of Firefox from version 0.6 to 0.7.1.

`protected checkBrowserFirebird() : bool`

##### Tags

access

  protected

##### Return values

bool —

Returns true if the browser is Firebird, false otherwise.

#### checkBrowserFirefox()

BrowserDetection.php : 930

Determine if the browser is Firefox or not.

`protected checkBrowserFirefox() : bool`

##### Tags

access

  protected

link
  https://www.mozilla.org/en-US/firefox/new/

##### Return values

bool —

Returns true if the browser is Firefox, false otherwise.

#### checkBrowserIcab()

BrowserDetection.php : 952

Determine if the browser is iCab or not.

`protected checkBrowserIcab() : bool`

##### Tags

access

  protected

link
  http://www.icab.de/

##### Return values

bool —

Returns true if the browser is iCab, false otherwise.

#### checkBrowserIceCat()

BrowserDetection.php : 964

Determine if the browser is GNU IceCat (formerly known as GNU IceWeasel) or not.

`protected checkBrowserIceCat() : bool`

##### Tags

access

  protected

link
  https://www.gnu.org/software/gnuzilla/

##### Return values

bool —

Returns true if the browser is GNU IceCat, false otherwise.

#### checkBrowserIceWeasel()

BrowserDetection.php : 975

Determine if the browser is GNU IceWeasel (now know as GNU IceCat) or not.

`protected checkBrowserIceWeasel() : bool`

##### Tags

access

  protected

see
  checkBrowserIceCat()

##### Return values

bool —

Returns true if the browser is GNU IceWeasel, false otherwise.

#### checkBrowserInternetExplorer()

BrowserDetection.php : 987

Determine if the browser is Internet Explorer or not.

`protected checkBrowserInternetExplorer() : bool`

##### Tags

access

  protected

link
  https://en.wikipedia.org/wiki/Internet_Explorer
link
  https://en.wikipedia.org/wiki/Internet_Explorer_Mobile

##### Return values

bool —

Returns true if the browser is Internet Explorer, false otherwise.

#### checkBrowserKonqueror()

BrowserDetection.php : 1078

Determine if the browser is Konqueror or not.

`protected checkBrowserKonqueror() : bool`

##### Tags

access

  protected

link
  https://www.konqueror.org/

##### Return values

bool —

Returns true if the browser is Konqueror, false otherwise.

#### checkBrowserLynx()

BrowserDetection.php : 1090

Determine if the browser is Lynx or not. It is the oldest web browser currently in general use and development.

`protected checkBrowserLynx() : bool`

It is a text-based only Web browser.

##### Tags

access

  protected

link
  https://en.wikipedia.org/wiki/Lynx_(web_browser)

##### Return values

bool —

Returns true if the browser is Lynx, false otherwise.

#### checkBrowserMozilla()

BrowserDetection.php : 1100

Determine if the browser is Mozilla or not.

`protected checkBrowserMozilla() : bool`

##### Tags

access

  protected

##### Return values

bool —

Returns true if the browser is Mozilla, false otherwise.

#### checkBrowserMsnTv()

BrowserDetection.php : 1111

Determine if the browser is MSN TV (formerly WebTV) or not.

`protected checkBrowserMsnTv() : bool`

##### Tags

access

  protected

link
  https://en.wikipedia.org/wiki/MSN_TV

##### Return values

bool —

Returns true if the browser is WebTv, false otherwise.

#### checkBrowserNetscape()

BrowserDetection.php : 1122

Determine if the browser is Netscape or not. Official support for this browser ended on March 1st, 2008.

`protected checkBrowserNetscape() : bool`

##### Tags

access

  protected

link
  https://en.wikipedia.org/wiki/Netscape

##### Return values

bool —

Returns true if the browser is Netscape, false otherwise.

#### checkBrowserNokia()

BrowserDetection.php : 1175

Determine if the browser is a Nokia browser or not.

`protected checkBrowserNokia() : bool`

##### Tags

access

  protected

link
  https://web.archive.org/web/20141012034159/http://www.developer.nokia.com/Community/Wiki/User-Agent_headers_for_Nokia_devices

##### Return values

bool —

Returns true if the browser is a Nokia browser, false otherwise.

#### checkBrowserOpera()

BrowserDetection.php : 1201

Determine if the browser is Opera or not.

`protected checkBrowserOpera() : bool`

##### Tags

access

  protected

link
  https://www.opera.com/
link
  https://www.opera.com/mobile/
link
  https://web.archive.org/web/20140220123653/http://my.opera.com/community/openweb/idopera/

##### Return values

bool —

Returns true if the browser is Opera, false otherwise.

#### checkBrowserPhoenix()

BrowserDetection.php : 1237

Determine if the browser is Phoenix or not. Phoenix was the name of Firefox from version 0.1 to 0.5.

`protected checkBrowserPhoenix() : bool`

##### Tags

access

  protected

##### Return values

bool —

Returns true if the browser is Phoenix, false otherwise.

#### checkBrowserSafari()

BrowserDetection.php : 1289

Determine if the browser is Safari or not.

`protected checkBrowserSafari() : bool`

##### Tags

access

  protected

link
  https://www.apple.com/safari/
link
  https://web.archive.org/web/20080514173941/http://developer.apple.com/internet/safari/uamatrix.html
link
  https://en.wikipedia.org/wiki/Safari_version_history#Release_history

##### Return values

bool —

Returns true if the browser is Safari, false otherwise.

#### checkBrowserSamsung()

BrowserDetection.php : 1328

Determine if the browser is the Samsung Internet browser or not.

`protected checkBrowserSamsung() : bool`

##### Tags

access

  protected

##### Return values

bool —

Returns true if the browser is the the Samsung Internet browser, false otherwise.

#### checkBrowserUAWithVersion()

BrowserDetection.php : 1347

Test the user agent for a specific browser that use a "Version" string (like Safari and Opera). The user agent should look like: "Version/1.0 Browser name/123.456" or "Browser name/123.456 Version/1.0".

`protected checkBrowserUAWithVersion(mixed $uaNameToLookFor, string $userAgent, string $browserName[, bool $isMobile = false ][, bool $findWords = true ]) : bool`

##### Parameters

$uaNameToLookFor : mixed

  The string (or array of strings) representing the browser name to find in the user agent.

$userAgent : string

  The user agent string to work with.

$browserName : string

  The literal browser name. Always use a class constant!

$isMobile : bool = false

  (optional) Determines if the browser is from a mobile device.

$findWords : bool = true

  (optional) Determines if the needle should match a word to be found. For example "Bar" would not be found in "FooBar" when true but would be found in "Foo Bar". When set to false, the needle can be found anywhere in the haystack.

##### Tags

access

  protected

##### Return values

bool —

Returns true if we found the browser we were looking for, false otherwise.

#### checkBrowserUC()

BrowserDetection.php : 1379

Determine if the browser is UC Browser or not.

`protected checkBrowserUC() : bool`

##### Tags

access

  protected

##### Return values

bool —

Returns true if the browser is UC Browser, false otherwise.

#### checkPlatform()

BrowserDetection.php : 1388

Determine the user's platform.

`protected checkPlatform() : mixed`

##### Tags

access

  protected

#### checkPlatformCustom()

BrowserDetection.php : 1458

Determine if the platform is among the custom platform rules or not. Rules are checked in the order they were added.

`protected checkPlatformCustom() : bool`

##### Tags

access

  protected

##### Return values

bool —

Returns true if we found the platform we were looking for in the custom rules, false otherwise.

#### checkPlatformVersion()

BrowserDetection.php : 1480

Determine the user's platform version.

`protected checkPlatformVersion() : mixed`

##### Tags

access

  protected

#### checkRobot()

BrowserDetection.php : 1591

Determine if it's a robot crawling the page and find it's name and version.

`protected checkRobot() : mixed`

##### Tags

access

  protected

#### checkRobotBingbot()

BrowserDetection.php : 1553

Determine if the robot is the Bingbot crawler or not.

`protected checkRobotBingbot() : bool`

##### Tags

access

  protected

link
  https://www.bing.com/webmaster/help/which-crawlers-does-bing-use-8c184ec0

##### Return values

bool —

Returns true if the robot is Bingbot, false otherwise.

#### checkRobotCustom()

BrowserDetection.php : 1607

Determine if the robot is among the custom robot rules or not. Rules are checked in the order they were added.

`protected checkRobotCustom() : bool`

##### Tags

access

  protected

##### Return values

bool —

Returns true if we found the robot we were looking for in the custom rules, false otherwise.

#### checkRobotGooglebot()

BrowserDetection.php : 1563

Determine if the robot is the Googlebot crawler or not.

`protected checkRobotGooglebot() : bool`

##### Tags

access

  protected

##### Return values

bool —

Returns true if the robot is Googlebot, false otherwise.

#### checkRobotMsnBot()

BrowserDetection.php : 1582

Determine if the robot is the MSNBot crawler or not. In October 2010 it was replaced by the Bingbot robot.

`protected checkRobotMsnBot() : bool`

##### Tags

access

  protected

see
  checkRobotBingbot()

##### Return values

bool —

Returns true if the robot is MSNBot, false otherwise.

#### checkRobotSlurp()

BrowserDetection.php : 1627

Determine if the robot is the Yahoo! Slurp crawler or not.

`protected checkRobotSlurp() : bool`

##### Tags

access

  protected

##### Return values

bool —

Returns true if the robot is Yahoo! Slurp, false otherwise.

#### checkRobotW3CValidator()

BrowserDetection.php : 1638

Determine if the robot is the W3C Validator or not.

`protected checkRobotW3CValidator() : bool`

##### Tags

access

  protected

link
  https://validator.w3.org/

##### Return values

bool —

Returns true if the robot is the W3C Validator, false otherwise.

#### checkRobotYahooMultimedia()

BrowserDetection.php : 1675

Determine if the robot is the Yahoo! multimedia crawler or not.

`protected checkRobotYahooMultimedia() : bool`

##### Tags

access

  protected

##### Return values

bool —

Returns true if the robot is the Yahoo! multimedia crawler, false otherwise.

#### checkSimpleBrowserUA()

BrowserDetection.php : 1696

Test the user agent for a specific browser where the browser name is immediately followed by the version number.

`protected checkSimpleBrowserUA(mixed $uaNameToLookFor, string $userAgent, string $browserName[, bool $isMobile = false ][, string $separator = '/' ][, bool $uaNameFindWords = true ]) : bool`

The user agent should look like: "Browser name/1.0" or "Browser 1.0;".

##### Parameters

$uaNameToLookFor : mixed

  The string (or array of strings) representing the browser name to find in the user agent.

$userAgent : string

  The user agent string to work with.

$browserName : string

  The literal browser name. Always use a class constant!

$isMobile : bool = false

  (optional) Determines if the browser is from a mobile device.

$separator : string = '/'

  (optional) The separator string used to split the browser name and the version number in the user agent.

$uaNameFindWords : bool = true

  (optional) Determines if the browser name to find should match a word instead of a part of a word. For example "Bar" would not be found in "FooBar" when true but would be found in "Foo Bar". When set to false, the browser name can be found anywhere in the user agent string.

##### Tags

access

  protected

##### Return values

bool —

Returns true if we found the browser we were looking for, false otherwise.

#### checkSimpleRobot()

BrowserDetection.php : 1725

Test the user agent for a specific robot where the robot name is immediately followed by the version number.

`protected checkSimpleRobot(mixed $uaNameToLookFor, string $userAgent, string $robotName[, string $separator = '/' ][, bool $uaNameFindWords = true ]) : bool`

The user agent should look like: "Robot name/1.0" or "Robot 1.0;".

##### Parameters

$uaNameToLookFor : mixed

  The string (or array of strings) representing the robot name to find in the user agent.

$userAgent : string

  The user agent string to work with.

$robotName : string

  The literal robot name. Always use a class constant!

$separator : string = '/'

  (optional) The separator string used to split the robot name and the version number in the user agent.

$uaNameFindWords : bool = true

  (optional) Determines if the robot name to find should match a word instead of a part of a word. For example "Bar" would not be found in "FooBar" when true but would be found in "Foo Bar". When set to false, the robot name can be found anywhere in the user agent string.

##### Tags

access

  protected

##### Return values

bool —

Returns true if we found the robot we were looking for, false otherwise.

#### cleanVersion()

BrowserDetection.php : 1745

Clean a version string from unwanted characters.

`protected cleanVersion(string $version[, mixed $toRemove = NULL ]) : string`

##### Parameters

$version : string

  The version string to clean.

$toRemove : mixed = NULL

  (optional) String or array of strings representing additional string(s) to remove.

##### Tags

access

  protected

##### Return values

string —

Returns the cleaned version number string.

#### containString()

BrowserDetection.php : 1793

Find if one or more substring is contained in a string.

`protected containString(string $haystack, mixed $needle[, bool $insensitive = true ][, bool $findWords = true ][, int &$foundPos = NULL ]) : bool`

##### Parameters

$haystack : string

  The string to search in.

$needle : mixed

  The string to search for. Can be a string or an array of strings if multiples values are to be searched.

$insensitive : bool = true

  (optional) Determines if we do a case-sensitive search (false) or a case-insensitive one (true).

$findWords : bool = true

  (optional) Determines if the needle should match a word to be found. For example "Bar" would not be found in "FooBar" when true but would be found in "Foo Bar". When set to false, the needle can be found anywhere in the haystack.

$foundPos : int = NULL

  (optional) Integer buffer that will contain the position of the needle (if found and if a non NULL variable has been passed).

##### Tags

access

  protected

##### Return values

bool —

Returns true if the needle (or one of the needles) has been found in the haystack, false otherwise.

#### detect()

BrowserDetection.php : 1825

Detect the user environment from the details in the user agent string.

`protected detect() : mixed`

##### Tags

access

  protected

#### findAndGetVersion()

BrowserDetection.php : 1846

Test the user agent for a specific browser and extract it's version.

`protected findAndGetVersion(type $uaNameToLookFor, type $userAgent, type &$version[, type $separator = '/' ][, type $uaNameFindWords = true ]) : bool`

##### Parameters

$uaNameToLookFor : type

  The string (or array of strings) representing the browser name to find in the user agent.

$userAgent : type

  The user agent string to work with.

$version : type

  String buffer that will contain the version found (if any).

$separator : type = '/'

  (optional) The separator string used to split the browser name and the version number in the user agent.

$uaNameFindWords : type = true

  (optional) Determines if the browser name to find should match a word instead of a part of a word. For example "Bar" would not be found in "FooBar" when true but would be found in "Foo Bar". When set to false, the browser name can be found anywhere in the user agent string.

##### Tags

access

  protected

##### Return values

bool —

Returns true if we found the browser we were looking for, false otherwise.

#### iOSVerToStr()

BrowserDetection.php : 1880

Convert the iOS version numbers to the operating system name. For instance '2.0' returns 'iPhone OS 2.0'.

`protected iOSVerToStr(string $iOSVer) : string`

##### Parameters

$iOSVer : string

  The iOS version numbers as a string.

##### Tags

access

  protected

##### Return values

string —

The operating system name.

#### macVerToStr()

BrowserDetection.php : 1913

Convert the macOS version numbers to the operating system name. For instance '10.7' returns 'Mac OS X Lion'.

`protected macVerToStr(string $macVer) : string`

Firefox, Safari and Chromium development teams have discovered a long tail of websites broken when reporting "Mac OS X 11" in the user agent string. In order to slightly improve user privacy as well as Web compatibility, they all capped the reported macOS version to 10.15 (Catalina) in the user agent string.

Firefox reported macOS version is capped at 10.15 since Firefox 87 (March 23, 2021). This change has been also backported in Firefox 78.9.0esr (March 23, 2021).

Safari reported macOS version is capped at 10.15.7 since Safari 14.1 (April 26, 2021).

Chromium reported macOS version is capped at 10.15.7 since Chromium 91.0.4437.0 (May 25, 2021).

See below links for more details.

##### Parameters

$macVer : string

  The macOS version numbers as a string.

##### Tags

access

  protected

link
  https://bugzilla.mozilla.org/show_bug.cgi?id=1679929
link
  https://github.com/WebKit/WebKit/commit/94d3ce0900c31c929798e91ea86dcfe604251a9e
link
  https://github.com/WebKit/WebKit/commit/a46b2c6dd07fab463f1b2353c5d5b2ff43000f58
link
  https://chromiumdash.appspot.com/commit/a632542e79f2589e1b3f470827c7d03092be0afb

##### Return values

string —

The operating system name or the constant PLATFORM_VERSION_UNKNOWN if nothing match the version numbers.

#### parseInt()

BrowserDetection.php : 1972

Get the integer value of a string variable.

`protected parseInt(string $intStr) : int`

##### Parameters

$intStr : string

  The scalar value being converted to an integer.

##### Tags

access

  protected

##### Return values

int —

The integer value of $intStr on success, or 0 on failure.

#### reset()

BrowserDetection.php : 1981

Reset all the properties of the class.

`protected reset() : mixed`

##### Tags

access

  protected

#### safariBuildToSafariVer()

BrowserDetection.php : 2005

Convert a Safari build number to a Safari version number.

`protected safariBuildToSafariVer(string $version) : string`

##### Parameters

$version : string

  A string representing the version number.

##### Tags

access

  protected

link
  https://web.archive.org/web/20080514173941/http://developer.apple.com/internet/safari/uamatrix.html

##### Return values

string —

Returns the Safari version string. If the version can't be determined, an empty string is returned.

#### set64bit()

BrowserDetection.php : 2099

Set if the browser is executed from a 64-bit platform.

`protected set64bit(bool $is64bit) : mixed`

##### Parameters

$is64bit : bool

  Value that tells if the browser is executed from a 64-bit platform.

##### Tags

access

  protected

#### setBrowser()

BrowserDetection.php : 2109

Set the name of the browser.

`protected setBrowser(string $browserName) : mixed`

##### Parameters

$browserName : string

  The name of the browser.

##### Tags

access

  protected

#### setMobile()

BrowserDetection.php : 2119

Set the browser to be from a mobile device or not.

`protected setMobile([bool $isMobile = true ]) : mixed`

##### Parameters

$isMobile : bool = true

  (optional) Value that tells if the browser is on a mobile device or not.

##### Tags

access

  protected

#### setPlatform()

BrowserDetection.php : 2129

Set the platform on which the browser is on.

`protected setPlatform(string $platform) : mixed`

##### Parameters

$platform : string

  The name of the platform.

##### Tags

access

  protected

#### setPlatformVersion()

BrowserDetection.php : 2139

Set the platform version on which the browser is on.

`protected setPlatformVersion(string $platformVer) : mixed`

##### Parameters

$platformVer : string

  The version numbers of the platform.

##### Tags

access

  protected

#### setRobot()

BrowserDetection.php : 2149

Set the browser to be a robot (crawler) or not.

`protected setRobot([bool $isRobot = true ]) : mixed`

##### Parameters

$isRobot : bool = true

  (optional) Value that tells if the browser is a robot or not.

##### Tags

access

  protected

#### setRobotName()

BrowserDetection.php : 2159

Set the name of the robot.

`protected setRobotName(string $robotName) : mixed`

##### Parameters

$robotName : string

  The name of the robot.

##### Tags

access

  protected

#### setRobotVersion()

BrowserDetection.php : 2169

Set the version of the robot.

`protected setRobotVersion(string $robotVersion) : mixed`

##### Parameters

$robotVersion : string

  The version of the robot.

##### Tags

access

  protected

#### setVersion()

BrowserDetection.php : 2185

Set the version of the browser.

`protected setVersion(string $version) : mixed`

##### Parameters

$version : string

  The version of the browser.

##### Tags

access

  protected

#### webKitBuildToSafariVer()

BrowserDetection.php : 2204

Convert a WebKit build number to a Safari version number.

`protected webKitBuildToSafariVer(string $version) : string`

##### Parameters

$version : string

  A string representing the version number.

##### Tags

access

  protected

link
  https://web.archive.org/web/20080514173941/http://developer.apple.com/internet/safari/uamatrix.html

##### Return values

string —

Returns the Safari version string. If the version can't be determined, an empty string is returned.

#### windowsNTVerToStr()

BrowserDetection.php : 2319

Convert the Windows NT family version numbers to the operating system name. For instance '5.1' returns 'Windows XP'.

`protected windowsNTVerToStr(string $winVer[, bool $returnServerFlavor = false ]) : string`

Windows 10 and Windows 11 share the same major version number (10). Windows 11 starts with build 22000 (version 10.0.22000) but the build is not included in the UA.

Windows Server 2022, 2019 & 2016 have also the same version number (10). Again, only the build can differentiate these versions.

##### Parameters

$winVer : string

  The Windows NT family version numbers as a string.

$returnServerFlavor : bool = false

  (optional) Since some Windows NT versions have the same values, this flag determines if the Server flavor is returned or not. For instance Windows 8.1 and Windows Server 2012 R2 both use version 6.3.

##### Tags

access

  protected

##### Return values

string —

The operating system name or the constant PLATFORM_VERSION_UNKNOWN if nothing match the version numbers.

#### windowsVerToStr()

BrowserDetection.php : 2364

Convert the Windows 3.x & 9x family version numbers to the operating system name. For instance '4.10.1998' returns 'Windows 98'.

`protected windowsVerToStr(string $winVer) : string`

##### Parameters

$winVer : string

  The Windows 3.x or 9x family version numbers as a string.

##### Tags

access

  protected

##### Return values

string —

The operating system name or the constant PLATFORM_VERSION_UNKNOWN if nothing match the version numbers.

#### wordPos()

BrowserDetection.php : 2398

Find the position of the first occurrence of a word in a string.

`protected wordPos(string $haystack, string $needle[, bool $insensitive = true ][, int $offset = 0 ][, string &$foundString = NULL ]) : mixed`

##### Parameters

$haystack : string

  The string to search in.

$needle : string

  The string to search for.

$insensitive : bool = true

  (optional) Determines if we do a case-sensitive search (false) or a case-insensitive one (true).

$offset : int = 0

  If specified, search will start this number of characters counted from the beginning of the string. If the offset is negative, the search will start this number of characters counted from the end of the string.

$foundString : string = NULL

  String buffer that will contain the exact matching needle found. Set to NULL when return value of the function is false.

##### Tags

access

  protected

##### Return values

mixed —

Returns the position of the needle (int) if found, false otherwise. Warning this function may return Boolean false, but may also return a non-Boolean value which evaluates to false.

## Search results