Created
September 5, 2023 12:06
-
-
Save moaalaa/e9fc0ecbd7ee11a854835a9f8e9e6d6f to your computer and use it in GitHub Desktop.
Detect Visitor Platform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function isAndroid() | |
{ | |
if (isset($_SERVER['HTTP_USER_AGENT'])) { | |
return strpos($_SERVER['HTTP_USER_AGENT'], 'Android') ? true : false; | |
} | |
return false; | |
} | |
function isIos() | |
{ | |
if (isset($_SERVER['HTTP_USER_AGENT'])) { | |
return (strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strpos($_SERVER['HTTP_USER_AGENT'], 'iPod') || strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')) ? true : false; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment