PHP 7 get_browser() Function
Example
Look up the browscap.ini file and return the capabilities of the browser:
<?php
echo $_SERVER['HTTP_USER_AGENT'];
$browser = get_browser();
 print_r($browser);
?>
Try it Yourself »
Definition and Usage
The get_browser() function looks up the user's browscap.ini file and returns the capabilities of the user's browser.
Syntax
get_browser(user_agent,return_array)
| Parameter | Description | 
|---|---|
| user_agent | Optional. Specifies the name of an HTTP user agent. Default is the value of $HTTP_USER_AGENT. You can bypass this parameter with NULL | 
| return_array | Optional. If this parameter is set to TRUE, the function will return an array instead of an object | 
Technical Details
| Return Value: | Returns an object or an array with information about the user's browser on success, or FALSE on failure | 
|---|---|
| PHP Version: | 4+ | 
| Changelog: | The return_array parameter was added in PHP 4.3.2 | 
❮ PHP Misc Reference

