php how detect mobile browser device Android ipad ipod

$user_agent       = $_SERVER['HTTP_USER_AGENT']; // get the user agent value
// look up for string as ipad, ipod, Android, Mobile etc.  
                // we find the word ipad in the user agent
                } elseif(preg_match('/android/i',$user_agent)) {
                  if (preg_match('/mobile/i',$user_agent)){
                  // we find Android and Mobile
                } elseif(preg_match('/ipod/i',$user_agent)) {
                // we find ipod
                } elseif(preg_match('/opera mini/i',$user_agent)) {
                // we find opera mini etc. etc. etc. 
This entry was posted in Smartphone and tagged . Bookmark the permalink.

Comments are closed.