views:

853

answers:

2

As strange as I find this, I have not been able to find a good PHP function anywhere which will do an intelligent parse of a user agent string? Googled it for about 20 minutes now.

I have the string already, I just need something that will chop it up and give me at least browser/ver/os.

Know of a good snippet anywhere?

+4  A: 

A 1 minute search found: User-Agent definition with regular expressions for parsing a user agent string.

Mitch Wheat
+7  A: 

The get_browser() function has been available in PHP for quite a long a time.

The PHP manual is free, can be downloaded in various formats and viewed online (with comments)

http://php.net/manual/en/function.get-browser.php

C.

symcbean
This would be a perfect example of how being up for more than two days can affect memory and cause you to ask extremely stupid questions about functions you already know about. :) Thanks
Spot