Function detect mobile device

function mobile_user_agent_switch(){ $device = ”; if( stristr($_SERVER[‘HTTP_USER_AGENT’],’ipad’) ) { $device = “ipad”; } else if( stristr($_SERVER[‘HTTP_USER_AGENT’],’iphone’) || strstr($_SERVER[‘HTTP_USER_AGENT’],’iphone’) ) {