PHP get_browser() Function

The get_browser() function looks up the user's browscap.ini file and returns the capabilities of the user's browser.

mixed get_browser ([ string $user_agent [, bool $return_array = FALSE ]] )

Attempts to determine the capabilities of the user's browser, by looking up the browser's information in the browscap.ini file.

Example -

ParameterDescription
user_agentThe User Agent to be analyzed. By default, the value of HTTP User-Agent header is used; however, you can alter this (i.e., look up another browser's info) by passing this parameter.You can bypass this parameter with a NULL value.
return_arrayIf set to TRUE, this function will return an array instead of an object.

Return Values

The information is returned in an object or an array which will contain various data elements representing, for instance, the browser's major and minor version numbers and ID string; TRUE/FALSE values for features such as frames, JavaScript, and cookies; and so forth.The cookies value simply means that the browser itself is capable of accepting cookies and does not mean the user has enabled the browser to accept cookies or not. The only way to test if cookies are accepted is to set one with setcookie(), reload, and check for the value.