We all know that browser compatibility is almost always an issue. What I'd like to know is if this way of telling which browser the user is using is a good practice.
Thank you in advance.
Code:
<?php
$who = strtolower($_SERVER['HTTP_USER_AGENT']);
if(preg_match("/msie/", $who)) {
//code for IE
}
elseif(preg_match("/mozilla/", $who)) {
//code for Firefox
}
else {
//code for Other Browsers
}
?>
Comment