You can not. Not with 100% accuracy. The best way to check the user agent, however the user is free not to supply it or fake, so try not to rely on him.
$ua = $_SERVER['HTTP_USER_AGENT'];
If the browser is IE, it should (roughly) match (where # is the number)
Mozilla/
-
'~^Mozilla/[0-9]\.0 (compatible;\s+MSIE~i'
"MSIE", .
, @Michal, get_browser ()