Browser detection using PHP

16 11
Read Time:25 Second
Today I will explain how to check what browser visitors are using with the help of user agent strings our default browser sends as a part of the HTTP request. The variable we can use to check browser is

$_server[‘http_user_agent’]

$_SERVER is a reserved super global PHP variable that contains all the web server informations.

Lets see the example and its output result.

<?php

echo $_SERVER[‘HTTP_USER_AGENT’];

?>


———————
Output

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

About Post Author

Vishal Barot

Hi there, Vishal Barot here. Full-time web developer and graphic designer with over 10 years of experience. I've been experimenting with web development since I was 17 years old. If you are looking to have a professional website or design then I can develop it for you. Looking forward to working with you.
Happy
Happy
19 %
Sad
Sad
11 %
Excited
Excited
19 %
Sleepy
Sleepy
21 %
Angry
Angry
18 %
Surprise
Surprise
12 %

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Comment

Your email address will not be published. Required fields are marked *

The maximum upload file size: 1 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop files here