PHP function to check proper user agent for mobile / tablet devices (server-side method)

function is_ios(){
    return strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') or strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') or strstr($_SERVER['HTTP_USER_AGENT'], 'iPod');
}