Code to parse user agent string?

Spot picture Spot · Jan 23, 2010 · Viewed 36.8k times · Source

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?

Answer

symcbean picture symcbean · Jan 23, 2010

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)