PHP

HOW TO DETECT MOBILE OR DESKTOP IN PHP

MOBILE DEVICE CHECK $isMob = is_numeric(strpos(strtolower( $_SERVER["HTTP_USER_AGENT"]), "mobile"));

USER AGENT CHECK

01

TABLET CHECK $isTab = is_numeric(strpos(strtolower( $_SERVER["HTTP_USER_AGENT"]), "tablet"));

DESKTOP? $isDesktop = !$isMob && !$isTab;

WINDOWS $isWin = is_numeric(strpos(strtolower( $_SERVER["HTTP_USER_AGENT"]), "windows"));   ANDROID $isAndroid = is_numeric(strpos(strtolower( $_SERVER["HTTP_USER_AGENT"]), "android"));

OTHER PLATFORM CHECKS (A)

02

OTHER PLATFORM CHECKS (B)

03

IPHONE IPAD $isIPhone = is_numeric(strpos(strtolower ($_SERVER["HTTP_USER_AGENT"]), "iphone")); $isIPad = is_numeric(strpos(strtolower( $_SERVER["HTTP_USER_AGENT"]), "ipad"));   IOS $isIOS = $isIPhone || $isIPad ;