53
useragent
user_agent
SYNOPSIS
user_agent()
DESCRIPTION
user_agent returns the User-Agent string sent by the client.
EXAMPLE
php > require 'library/useragent.php';
php > var_dump(user_agent());
string(83) "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:153.0) Gecko/20100101 Firefox/153.0"
CODE
- function user_agent() {
- return !empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : false;
- }
user_agent returns the value of $_SERVER['HTTP_USER_AGENT'], or false if it is not available.
Comments