Home >Backend Development >PHP Tutorial >get_browser() function in PHP

get_browser() function in PHP

WBOY
WBOYforward
2023-09-09 18:41:03981browse

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.

Syntax

get_browser(user, return_array)

Parameters

  • 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.

Return value

The get_browser() function returns an object or array containing information about the user's browser.

Example

Note − Results will vary depending on the system.

Example

<?php
   echo $_SERVER[&#39;HTTP_USER_AGENT&#39;];
   $browseeInfo = get_browser();
   print_r($browserInfo);
?>

Output

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete