You can use the reserved variable $_SERVER to check the user agent. The user agent will give you the name of the browser.
Here is a sample PHP code to check the browser name.
<?phpif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE || strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== FALSE) echo 'You are using Internet Explorer.<br />';elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== FALSE) echo 'You are using Chrome.<br />';elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== FALSE) echo 'You are using Firefox.<br />';else echo 'Unknown browser.<br />';?>
see here https://www.php.net/manual/function.get-browser.php