How to detect device in various PHP platform like CakePHP

How to detect device in various PHP platform like CakePHP

This is very simple and useful method to detect device like Android or iPhone in to your website in Core PHP and other platforms.

Core PHP
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
$Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android");

CakePHP
$isMobile = $this->request->is('mobile');
$isAndroid = stripos($this->request->header('User-Agent'), 'Android');
$isIPhone = stripos($this->request->header('User-Agent'), 'iPhone');
$isIPad = stripos($this->request->header('User-Agent'), 'iPad');