Posted By

stianlagstad on 04/30/13


Tagged

php android


Versions (?)

Function to detect if the visitor is on an android device


 / Published in: PHP
 

This simple functions scans the user agent for the word "android" and returns true if found. Useful if there's something you only want android visitors to see (or not see).

  1. function isItAndroid()
  2. {
  3. $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
  4. if(stripos($ua,'android') !== false) return true;
  5. else return false;
  6. }

Report this snippet   <

You need to login to post a comment.