Just a few notes here for personal reference. For people un-familiar with PHP, get_browser(); is a nifty little function that allows server-side scripting to detect browser capabilities. However it does rely on the browscap.ini directive in PHP.INI being enabled and using a valid path to a browscap.ini file somewhere.

Trouble is browsers seem to be changing every five minutes, and new ones added, so keeping an up-to-date list is somewhat of a nightmare.

One Gary Keith whose made it his life's mission to keep an up-to-date browscap.ini file for the developers of the world. As an addendum. Thank You ! : )

http://browsers.garykeith.com/downloads.asp

Some other info. for personal reference, as this is what started this whole tangent in the first place, is IE7 Compatibility View. A feature that Microsoft have enabled in IE8 to force IE7 standards mode to provide some backwards-compatibility in their new browser.

There is a nifty little tag you can include in your HTML to force this, and by default it also disables the IE7 Compatilbilty View button in IE8. Nice !

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

Here's the official Microsoft splurge about it : http://msdn.microsoft.com/en-us/library/cc817574.aspx

Something worthy of note :

"The X-UA-compatible header is not case sensitive; however, it must appear in the Web page's header (the HEAD section) before all other elements, except for the TITLE element and other META elements."

Some quick PHP IE detection script. Returns major version. i.e. 6,7,8 etc...

<?php
$sUA = $_SERVER['HTTP_USER_AGENT'];
function getInternetExplorerVersion($sUA){
	// RegEX courtesty of Microsoft MSDN : http://msdn.microsoft.com/en-us/library/ms537509(VS.85).aspx.
	preg_match('/MSIE ([0-9]{1,}[\.0-9]{0,})/',trim($sUA), $arrMatches);
	if(ini_get('browscap')){
		if(function_exists('get_browser')){
			$arrBrowserComponents = get_browser(null, true);
			if(!empty($arrBrowserComponents['version'])){
				return floor($arrBrowserComponents['version']);
			}else{
				// Use fall back method
				if(isset($arrMatches[1]) && !empty($arrMatches[1])){
					return floor ($arrMatches[1]);
				} else {
					return null;
				}
			}
		}
	} else {
		// Use fall back method
		if(isset($arrMatches[1]) && !empty($arrMatches[1])){
			return floor ($arrMatches[1]);
		} else {
			return null;
		}
	}
}

echo getInternetExplorerVersion($sUA);
?>