1
2
3
4
5
6
7
$is_iphone = ((strpos(lowerTrim($_SERVER["HTTP_USER_AGENT"]), "iphone") !== false) || (strpos(lowerTrim($_SERVER["HTTP_USER_AGENT"]), "ipod") !== false));
 $is_bberry = (strpos(lowerTrim($_SERVER["HTTP_USER_AGENT"]), "blackberry") !== false);
 $is_nokia = (strpos(lowerTrim($_SERVER["HTTP_USER_AGENT"]), "series60") !== false);
 $is_pre = (strpos(lowerTrim($_SERVER["HTTP_USER_AGENT"]), "pre/") !== false || strpos(lowerTrim($_SERVER["HTTP_USER_AGENT"]), "webos/") !== false);
 $is_mobile = ($is_iphone || $is_bberry || $is_pre || $is_nokia || strpos(lowerTrim($_SERVER["HTTP_USER_AGENT"]), "iemobile") !== false || strpos(lowerTrim($_SERVER["HTTP_USER_AGENT"]), "blazer") !== false);

// later you can use <? if $is_iphone ?> blah blah <? endif; ?>