Search code examples
phpparsinguser-agentstring-parsing

Code to parse user agent string?


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?


Solution

  • 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)