Skip to content

Instantly share code, notes, and snippets.

@reaneyk
Created November 14, 2012 22:46
Show Gist options
  • Save reaneyk/4075393 to your computer and use it in GitHub Desktop.
Save reaneyk/4075393 to your computer and use it in GitHub Desktop.
Simple mobile device detection
<?php
preg_match('/(Android|iPad|iPhone|iPod)/', $_SERVER['HTTP_USER_AGENT'], $mobile_device);
if(!empty($mobile_device)) {
print 'By George, we have a mobile device.';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment