Check if device is mobile (iOS, iPhone iPad, iPod, Android, WebOS, Windows Mobile, Blackberry) inside PHP

<?php
$isAndroid 			= (bool) stripos($_SERVER['HTTP_USER_AGENT'],"Android");
$isiPad 			= (bool) stripos($_SERVER['HTTP_USER_AGENT'],'iPad');
$isiPhone 			= (bool) stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$isiPod 			= (bool) stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
$iswebOS 			= (bool) stripos($_SERVER['HTTP_USER_AGENT'],"webOS");
$isBlackBerry 		= (bool) stristr($_SERVER['HTTP_USER_AGENT'],'blackberry');
$isWindowsMobile 	= (bool) stristr($_SERVER['HTTP_USER_AGENT'],"Windows Mobile");
$isMobile 	= ($isAndroid || $isiPad || $isiPhone || $isiPod || $iswebOS || $isBlackBerry || $isWindowsMobile)
?>