How to get Browser Information In PHP
by
Anuj Kumar
A Browser is application software used to open web pages from servers or over the internet. A browser is application software which displays content from the World Wide Web, which includes images, video etc. Today there are many browsers available in the market.
Some browsers are as follows:
Intenet Explorer
Firebox
Google Chrome
Safari etc…
To Find Browser Name in PHP
If you want to know a browser name through PHP then you can do that. For this purpose you will use the following code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
<html> <body> <h4>Browser Information</h4> <?php $browser=""; if(strrpos(strtolower($_SERVER["HTTP_USER_AGENT"]),strtolower("MSIE"))) { $browser="Internet Explorer"; } else if(strrpos(strtolower($_SERVER["HTTP_USER_AGENT"]),strtolower("Presto"))) { $browser="Opera"; } else if(strrpos(strtolower($_SERVER["HTTP_USER_AGENT"]),strtolower("CHROME"))) { $browser="Google Chrome"; } else if(strrpos(strtolower($_SERVER["HTTP_USER_AGENT"]),strtolower("SAFARI"))) { $browser="Safari"; } else if(strrpos(strtolower($_SERVER["HTTP_USER_AGENT"]),strtolower("FIREFOX"))) { $browser="FIREFOX"; } else { $browser="OTHER"; } echo "Your Browser is :" .$browser; ?> </body> </html> |
Tags: browser information in phphow tophp
Anuj Kumar
Hi! I am Anuj Kumar, a professional web developer with 5+ years of experience in this sector. I found PHPGurukul in September 2015. My keen interest in technology and sharing knowledge with others became the main reason for starting PHPGurukul. My basic aim is to offer all web development tutorials like PHP, PDO, jQuery, PHP oops, MySQL, etc.
Apart from the tutorials, we also offer you PHP Projects, and we have around 100+ PHP Projects for you.
Recommended tutorial for you
You may also like...