how can I alter my script so that just the browser version and name is only displayed using’ HTTP_USER_AGENT’? I still need my script to cover all modern browsers just incase someone helps me and specifies the code only for the safari browser.
In my code the current output is “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.2 Safari/605.1.15” just to make it cleat I’m on looking for this to be display “BROWSER NAME + BROWSER VERSION”.
Any tutorial links as well would be greatly appreciated.
<!DOCTYPE html> <html> <body> <?php echo $_SERVER['HTTP_USER_AGENT']; $browser = get_browser(); print_r($browser); ?>
I also tried this as well below.
<?php $browser = get_browser($_SERVER['HTTP_USER_AGENT'], true); echo $browser['browser'] . '+' . $browser['version']; ?> </body> </html>