Detect Mobile OS

if(!function_exists('mobile_os')){
	function mobile_os(){
		//Detect special conditions devices
		//logg($_SERVER['HTTP_USER_AGENT']);
		$iPod    = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
		$iPhone  = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
		$iPad    = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
		$Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android");
		$webOS   = stripos($_SERVER['HTTP_USER_AGENT'],"webOS");

		//do something with this information
		if( $iPod || $iPhone ){
		    return 'ios';
		}else if($iPad){
		    return 'ios';
		}else if($Android){
		    return 'android';
		}else if($webOS){
		    return 'web';
		}else{
			return 'web';
		}
	}
}