how to detect internet explorer and firefox using PHP?
So that's not what you asked for. But it's often more senseful to differentiate on features:
if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) {
// Firefox, Safari, Opera, Chrome, IE9
}
else {
// IE5,IE6,IE7,IE8
}
None of the garbage versions of IE supports XHTML for example. So that's a good way to separate browsers. Note how IE9 however counts into the newer class, and might actually be treated comparable to Firefox.