การตรวจสอบ Browser ว่าอยู่บน Mobile Platform ใด ด้วย PHP

$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
$ua_checker = array(
  'android'=>preg_match('/android/', $ua),
  'iphone'=>preg_match('/iphone|ipod|ipad/', $ua),
  'blackberry'=>preg_match('/blackberry/', $ua)
)
if ($ua_checker['android']) {
  // up to you
}
else if ($ua_checker['iphone']) {
  // up to you
}
else if ($ua_checker['blackberry']) {
  // up to you
}