PHP can only test the useragent and has no way of telling what the browser is. What browser is it when the useragent reads “Eat At Joe’s”?
Since Internet Explorer and Firefox can both set the useragent to anything at all there is no way of distinguishing between those two browsers by using the useragent.
Since Safari, Chrome, Opera, and many other browsers can set their useragent to identify themselves as Internet Explorer or Firefox (sometimes automatically without the browser user’s knowledge) there is no way to tell what the browser is if the useragent says Internet Explorer or Firefox since it can say that for ANY browser.
For most users this is sufficient; the main justification for implementing such a script for me was to inform users using antiquated browsers like IE 6 that newer versions exist which would improve their experience. Most of these users likely don’t have the savy to be modifying their user agents.
On a semi-related note, one thing to watch out for if you use any flash on your page, is that flash will report a different user agent from the browser it is running in.