Skip to content

Instantly share code, notes, and snippets.

@artikus11
Created March 24, 2017 07:38
Show Gist options
  • Save artikus11/2345b6678169a13fea2a7feebd196759 to your computer and use it in GitHub Desktop.
Save artikus11/2345b6678169a13fea2a7feebd196759 to your computer and use it in GitHub Desktop.
Функция определения типа устройства
define("DEV_DEFAULT", 0);
define("ANDROID", 1);
define("IOS", 2);
function getDeviceType(){
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
if(stripos($ua,'android') !== false) { return ANDROID; }
if(stripos($ua,'iPhone') !== false) { return IOS;}
if(stripos($ua,'iPad') !== false) { return IOS; }
return DEV_DEFAULT;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment