Get browser properties without browscap in php

There are several methods to get browser properties. php get_browser function is very useful as it return many browser properties.but In for get_browser to work, your browscap configuration setting in php.ini must point to the correct location of the browscap.ini file on your system.

output of get_browser php function

But if you dont have permission to your php.ini file you can use the alternative


HTTP_USER_AGENT response on different browser



Opera/9.80 (Windows NT 6.1) Presto/2.12.388 Version/12.15




Based on the above pattern I made a custom php function like get_browser ,
but not provide actually same data provided by get_browser.  it can give you essential information like browser name and its version.

Response :

php function alternative to get_browser

Watch this php function live


How to use.

just simple : if you want to load the css based on browser version or name

Hope  it will help. any feedback for improvement is appreciable.
happy coding.