Skip to content

Instantly share code, notes, and snippets.

@yurivictor
Created June 19, 2012 19:01
Show Gist options
  • Save yurivictor/2955904 to your computer and use it in GitHub Desktop.
Save yurivictor/2955904 to your computer and use it in GitHub Desktop.
iPhone detection function (PHP)
<?php
function iOSDetect() {
$browser = strtolower( $_SERVER['HTTP_USER_AGENT'] );
if( strstr( $browser, 'iphone' ) || strstr( $browser, 'ipod' ) )
$device = 'iphone';
return( $device );
}
iOSDetect();
if ( $device == 'iphone' )
echo 'iphone';
else
echo 'default';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment