<?php $agent = strtolower($_SERVER['HTTP_USER_AGENT']); $iphone = (strpos($agent, 'iphone')) ? true : false; $ipad = (strpos($agent, 'ipad')) ? true : false; $android = (strpos($agent, 'android')) ? true : false; if($iphone || $ipad) { echo <<<END <script>alert('iphone or ipad')</script> END; } if($android){ echo "<script>alert('android')</script>"; } ?>