I was wondering, until now, why someone had not posted a slightly alteration of the accepted answer to the use of implode[]
in order to have a better readability of the code. So here it goes:
Output: We are accessing it from a laptop.
Mobile Browser Not DetectedHow can I get device detail in PHP?
php $useragent=$_SERVER['HTTP_USER_AGENT']; if[preg_match['/[android|bb\d+|meego]..Unzip the file into a directory in your PHP server..Then add the following code to your PHP page:.All available device information will be contained in $_51d array:.How can you detect a mobile device using PHP?
Here is the code: php $useragent=$_SERVER['HTTP_USER_AGENT']; if[preg_match['/[android|bb\d+|meego]. +mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip[hone|od]|iris|kindle|lge |maemo|midp|mmp|netfront|opera m[ob|in]i|palm[ os]?|How check PHP or mobile in PC?
An easy way to detect a mobile or desktop device in PHP is to check if the HTTP user agent contains the word “mobile”. $ua = strtolower[$_SERVER["HTTP_USER_AGENT"]]; $isMob = is_numeric[strpos[$ua, "mobile"]];How does my tablet detect PHP?
The only way to do this is with a huge lookup table of User-Agent: strings. get_browser[] would probably be able to do what you want, but you would need to make sure that you keep the browscap file very up to date - new tablet models are being released on a weekly basis.