Any php code to detect the browser with version and operating system?

php

Solution

I used the techpatterns.com one and they don't always update it and it use procedural code which feel dated...

The Wolfcast BrowserDetection PHP class is updated and use an Object-Oriented way to do it:

You use it this way:

$browser = new BrowserDetection();
echo 'You are using ', $browser->getBrowser(), ' version ', $browser->getVersion();

Another example:

$browser = new BrowserDetection();
if ($browser->getBrowser() == BrowserDetection::BROWSER_FIREFOX && $browser->compareVersions($browser->getVersion(), '5.0.1') !== 1) {
    echo 'You have FireFox version 5.0.1 or greater. ';
}

Problem

I tried to search in google but cannot find a complete solution (i only find something detects only the browser's type like firefox, opera) . i want a php class or code to check the user's Browser including the version and also the operating system. Thanks

Original source