<?php
// check what browser the visitor is using
$user_agent = $_SERVER['HTTP_USER_AGENT'];
// This bit differentiates IE from Opera
if(preg_match('/MSIE/i',$u_agent) && !preg_match('/Opera/i',$u_agent))
{
print
'This is Internet Explorer. (Insert joke here)';
}
elseif(preg_match('/mozilla/i',$u_agent) && !preg_match('/compatible/', $userAgent))
{
print
'This is FireFox.';
}
// let Chrome be recognized as Safari
elseif(preg_match('/webkit/i',$u_agent))
{
print
'This is either Chrome or Safari.';
}
elseif(preg_match('/Opera/i',$u_agent))
{
print
'This is Opera. Like to live on the edge, huh?';
}
elseif(preg_match('/Netscape/i',$u_agent))
{
print
'This is Netscape, and you really need to upgrade.';
}
?>