Home > Article > Backend Development > get_browser() function in PHP
The get_browser() function finds the user's browscap.ini file and returns the capabilities of the user's browser.
get_browser(user, return_array)
user − The name of the HTTP user agent.
return_array − If this parameter is set to true, the function will return an array instead of an object.
The get_browser() function returns an object or array containing information about the user's browser.
Note − Results will vary depending on the system.
<?php echo $_SERVER['HTTP_USER_AGENT']; $browseeInfo = get_browser(); print_r($browserInfo); ?>
The following is the output.
Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/70.0.3538.110 Safari/537.36
The above is the detailed content of get_browser() function in PHP. For more information, please follow other related articles on the PHP Chinese website!