Browser detection in php is simple. You can detect the browser and OS version using PHP in two ways.
Method # 1
The first way to do it is simply by using the variable $HTTP_USER_AGENT, which holds information about browser version, name etc. Also you can use it like $_SERVER['HTTP_USER_AGENT']. This variable holds the information related to the browser and the operating system.
Method # 2
The second one is to use php's get_browser function, though it has it drawbacks, because you need a browsercap.ini which has to be present at your isp, it gives much more information than other ways.
click here for more info