PHP script to detect mobile devices


PHP script to detect mobile devices : You can detect the mobile devices using the php script. Here is an example of getting mobile devices which uses user agent and pattern to match the mobile device.


PHP script to detect mobile devices

Php function to get mobile devices –

PHP script to detect mobile devices

function isMobileDevice() {
$match = preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]);
	return $match;
}

The function will return true if mobile device found else it will return false.


Advertisements

Add Comment

📖 Read More