Revision: 26413
Updated Code
at April 27, 2010 16:05 by naz
Updated Code
function getServerSoftware($key = 'SERVER_SOFTWARE')
{
$regex = "/(?<software>\w+)\/(?<version>[0-9.a-z]*)/";
if(isset($_SERVER[$key]) && preg_match_all($regex, $_SERVER[$key], $arr))
return array_combine($arr['software'], $arr['version']);
else
return array();
}
//USAGE EXAMPLE
//get array
$serverInfo = getServerInfo();
//print apache version
echo $serverInfo['Apache'];
//print all information
foreach($serverInfo as $software=>$version) echo "{$software}: {$version}<br>\n";
Revision: 26412
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 27, 2010 16:03 by naz
Initial Code
function getServerSoftware($key = 'SERVER_SOFTWARE')
{
$regex = "/(?<software>\w+)\/(?<version>[0-9.a-z]*)/";
if(isset($_SERVER[$key]) && preg_match_all($regex, $_SERVER[$key], $arr))
return array_combine($arr['software'], $arr['version']);
else
return array();
}
Initial URL
Initial Description
this function return associative array from SERVER_SOFTWARE
Initial Title
Get Apache Version and other installed software versions as associative array
Initial Tags
regex, php, apache
Initial Language
PHP