X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP get_browser() Function

PHP Misc Reference PHP Misc Reference

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);
?>

Run example »

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 PHP Misc Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook