What are some alternative methods to $_ENV['HTTP_USER_AGENT'] for determining the operating system and browser in PHP?

When $_ENV['HTTP_USER_AGENT'] is not available or unreliable, an alternative method to determine the operating system and browser in PHP is to use the get_browser() function. This function retrieves information about the user's browser and operating system based on the User-Agent header sent by the browser.

$browser_info = get_browser(null, true);
$browser = $browser_info['browser'];
$os = $browser_info['platform'];

echo "Browser: $browser\n";
echo "Operating System: $os\n";