How do you get the Browser information?

Answer Posted / ravi rajendra k

If you need a parser for getting OS, browser name and version details, use this pattern in a preg_match_all function.

$pattern = '#(?<browser>' . join('|', $known) .')[/ ]+(?<version>[0-9]+(?:\.[0-9]+)?)#i';

You can see my article www.peacemax.com/11/php/user-agents-php-snippet where i wrote the entire function for getting those details.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of basename() function in PHP?

591


How to insert an new array element in array?

527


Why php is used with mysql?

522


Where can I learn php?

525


What are the two most common ways to start and finish a php block of code?

619






What is the use of array_search() in php?

523


What is overloading and overriding in php?

545


Why do we use cookie?

536


What are the disadvantages of php?

504


What is a query give example?

515


How are cookies created?

536


What are the types of variables in php?

527


Why should I learn php?

506


What are Routines?

1768


What is abstraction php?

523