Latest web development tutorials

PHP get_browser () function

PHP Misc Reference Manual PHP Misc Reference Manual

Examples

Now users browscap.ini file, and returns the user's browser performance:

<?php
echo $_SERVER['HTTP_USER_AGENT'];
$browser = get_browser();
print_r($browser);
?>

Running instance »

Definition and Usage

get_browser () function to view the user's browscap.ini file, and returns the user's browser performance.


grammar

get_browser( user_agent,return_array )

参数 描述
user_agent 可选。规定 HTTP 用户代理的名称。默认是 $HTTP_USER_AGENT 的值。您可以通过设置 NULL 绕过该参数。
return_array 可选。如果该参数设置为 TRUE,本函数会返回一个数组而不是对象。

technical details

return value: If successful, the function returns an object that contains information about the user's browser or an array. If it fails, it returns FALSE.
PHP version: 4+
Update log: In PHP 4.3.2, add the return_array parameters.


PHP Misc Reference Manual PHP Misc Reference Manual