Web browser identification 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

$_SERVER[‘HTTP_USER_AGENT’]

HTTP_USER_AGENT response on different browser

FIREFOX

CHROME

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

SAFARI

IE9

IE8

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

Demo

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.

,