Detect Mobile Safari with PHP

It’s really easy to detect mobile Safari with PHP:

$isMobileSafari = preg_match('/(iPod|iPhone|iPad)/', $_SERVER['HTTP_USER_AGENT']);

The variable is TRUE is it’s mobile Safari on an iPod, iPhone or iPad, FALSE otherwise.


About Joseph R. B. Taylor

Joseph R. B. Taylor is a humble designer/developer who makes stuff for screens of all shapes and sizes. He is currently the lead UI/UX Architect at MScience, LLC, where he works to create simple experiences on top of large rich datasets for their customers and clients.