помощ с preg_match за показване на версията на браузъра

talevtehnology

Registered
Здравейте още ме мъчи този проблем с кода по доло показвам версията на браузера но така тя излиза така:

Код:
Browser Version: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.53 Safari/534.3
как мога да взема само цифрите след chrome/
с preg_match за сега успявам да извадя само това 534.3
Код:
<?php 
$os = getos(); 
$agent2 = $_SERVER['HTTP_USER_AGENT']; 
function getos(){ 
$agent = $_SERVER['HTTP_USER_AGENT']; 
if(strstr($agent,'Win')){ 
if(strstr($agent,'NT 5.0') || strstr($agent,'NT5.0') || strstr($agent,'Windows 2000')){ $os = "Windows 2000"; 
}else if(strstr($agent,'NT 5.1') || strstr($agent,'NT5.1') || strstr($agent,'Windows XP')){$os = "Windows XP"; 
}else if(strstr($agent,'Win98') || strstr($agent,'Windows 98')){$os="Windows 98";
}else if(strstr($agent,'NT')) {$os='Windows NT'; 
}else if(strstr($agent,'Win95') || strstr($agent,'Windows 95')){$os='Windows 95'; 
}else if(strstr($agent,'Win 9x')) {$os='Windows 95'; 
}else if(strstr($agent,'WinME') || strstr($agent,'Windows ME')){$os='Windows ME';
}else{$os='Windows (version unspecified)';} 

}else if (strstr($agent,'Mac')){$os='Apple Macintosh'; 
}else if (strstr($agent,'Linux')){$os='Linux'; 
}else if (strstr($agent,'BeOS')){$os='BeOS'; 
}else if (strstr($agent,'Unix') || strstr($agent, "HP-ux") || strstr($agent, "X11")){$os='Unix'; 
}else if (strstr($agent,'SunOS')){$os='SunOS'; 
}else if (strstr($agent,'FreeBSD')){$os='FreeBSD'; 
}else if (strstr($agent,'OpenBSD')){$os='OpenBSD'; 
}else if (strstr($agent,'IRIX')){$os='IRIX'; 
}else if (strstr($agent,'spider') || strstr($agent,'bot') || strstr($agent,'http') || strstr($agent,'Scooter') || strstr($agent,'WebCopier')){$os='Spiders'; 
}else{$os='Unspecified'; 
} 
return $os; 
} 

echo " 
<html> 
<head> 
<title>test..</title> 
</head> 
<body> 
<br> 
<h2 align='center'>IP Information</h2> 
<center> 

Browser Name: $agent<br/> 
Browser Version: $agent2<br /> 

Cookies Enabled:       <script Language=\"JavaScript\"> 
       
      </script> 
<br/> 
Platform: $os"; 
?>
 
Код:
$string = "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.53 Safari/534.3";

preg_match("/chrome\/([^\s]*)/si", $string, $match);
echo $match[1];

??
 

Back
Горе