Created
August 29, 2023 11:14
-
-
Save stefanRepac/dbca179d00a7b5c04d94d785de44e628 to your computer and use it in GitHub Desktop.
Check UserAgent if it's mobile in PHP
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
function isMobileDevice2() { | |
return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]); | |
} | |
if( isMobileDevice2() === 1 || isMobileDevice2() === false) { | |
// Magic | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment