What are some alternative methods for identifying users on mobile devices, such as operating system or browser information?

When identifying users on mobile devices, you can use alternative methods such as checking the operating system or browser information. This can be helpful for customizing the user experience or tracking user behavior based on their device.

<?php
// Get the user agent string
$user_agent = $_SERVER['HTTP_USER_AGENT'];

// Check if the user is using a mobile device
if (strpos($user_agent, 'Android') !== false) {
    echo 'User is using an Android device';
} elseif (strpos($user_agent, 'iPhone') !== false || strpos($user_agent, 'iPad') !== false) {
    echo 'User is using an iOS device';
} else {
    echo 'User is using a different device';
}
?>