Detect mobile or desktop in php This is the function which return boolean value whether it is mobile or desktop. function isMobile() { return is_numeric(strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "mobile")); }