 <?php
   $user_agents = array(
      "midp", "j2me", "iphone", "avantg", "docomo", "novarra", "palmos", 
      "palmsource", "240x320", "opwv", "chtml", "pda", "windows\ ce", "mmp\/", 
      "blackberry", "mib\/", "symbian", "wireless", "nokia", "hand", "mobi", 
      "phone", "cdm", "up\.b", "audio", "sie\-", "sec\-", "samsung", "htc", 
      "mot\-", "mitsu", "sagem", "sony", "alcatel", "lg", "erics", "vx", "nec", 
      "philips", "mmm", "xx", "panasonic", "sharp", "wap", "sch", "rover", 
      "pocket", "benq", "java", "pt", "pg", "vox", "amoi", "bird", "compal", 
      "kg", "voda", "sany", "kdd", "dbt", "sendo", "sgh", "gradi", "jb", "\d\d\di", "moto", 
      "ipad", "android", "ipod", "webos");

 $agent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; MAAU)";

    foreach ($user_agents as $user_string) {
      if (preg_match("/" .  $user_string . "/i", strtolower($agent))) 
      echo "hit";
    }

?>