function get_device_name() { // Do the most exhaustive device detection possible; other method calls // may be used instead of DetectMobileLong if you want to target a narrower // class of devices. $mobile = new uagent_info(); if ($mobile->DetectKindle()) { return 'Kindle'; } elseif ($mobile->DetectKindleFire() || $mobile->DetectAmazonSilk()) { return 'Kindle Fire'; } elseif ($mobile->DetectIpad()) { return 'iPad'; } elseif ($mobile->DetectIphone()) { return 'iPhone'; } elseif ($mobile->DetectMac()) { return 'Mac'; } elseif ($mobile->DetectAndroidPhone()) { return 'Android Phone'; } elseif ($mobile->DetectAndroidTablet()) { return 'Android Tablet'; } elseif ($mobile->DetectBlackBerry()) { return 'BlackBerry'; } elseif ($mobile->DetectGoogleTV()) { return 'Google TV'; } elseif ($mobile->DetectIos()) { return 'iOS'; } else { return 'PC'; } }