Forum Moderators: coopster
<?php
$ua = $_SERVER['HTTP_USER_AGENT'];
if ((stristr($ua, 'MSIE') == TRUE) & ($ua > 5.5))
{
echo 'You are using MSIE older then 5.5';
}
?>
What in the php dom would I use to detect a number in my $ua variable?
Here is something I just found as well..though it does not seem to work. I've tested it with IE 3.0, 4.0, 5.01, 5.5, and 6.0.
<?php
//HACK FOR DETERMINING HTMLAREA COMPATIBILITY
//make user agent into an array
$browser = explode(' ',$HTTP_USER_AGENT);
//Get key for MSIE if in the array
$i = array_search('MSIE',$browser);
//if found MSIE
if ($i > 0)
{
//Get MSIE version, trim trailing ;
$browserver = rtrim($browser[$i+1],";");
//check version is at least 5.5
if (floatval($browserver) >= 5.5)
echo 'You are using first';
} ELSE {
echo 'You are using second';
}
?>