echo $_SERVER['HTTP_USER_AGENT'];
/* You can use any method to inspect the variable,
   such as echo or var_dump($_SERVER['HTTP_USER_AGENT']); */
Output Sample output of the $_SERVER['HTTP_USER_AGENT'] variable, showing only partial information for clarity
if (stripos($_SERVER['HTTP_USER_AGENT'], 'chrome') !== false) {
    echo 'The visitor is using the Chrome browser.';
}
$ua = $_SERVER['HTTP_USER_AGENT'];

if ((stripos($ua, 'safari') !== false) && (stripos($ua, 'chrome') === false)) {
    echo 'The visitor is using the Safari browser.';
}
if (stripos($_SERVER['HTTP_USER_AGENT'], 'firefox') !== false) {
    echo 'The visitor is using the Firefox browser.';
}