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. This blog is a space where I share insights, experiences, and knowledge about the digital world. From programming languages I’ve mastered to internet scams and fraud to watch out for, you’ll find a mix of practical tips and cautionary tales. Whether you're a fellow developer, designer, or just a curious reader, I hope my posts provide value and spark your interest.
Happy
Happy
11
Sad
Sad
6
Excited
Excited
11
Sleepy
Sleepy
12
Angry
Angry
11
Surprise
Surprise
6

Leave a Comment

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

Scroll to Top