检查php版本
<PRE>sample call:if(!check_version(PHP_VERSION, "4.1.0") ){ echo 'Current PHP version: ' . PHP_VERSION . ' is too low for this code!<p>';}Function:# Compares versions of software# versions must must use the format ' x.y.z... ' # where (x, y, z) are numbers in function check_version($currentversion, $requiredversion){ list($majorC, $minorC, $editC) = split('[/.-]', $currentversion); list($majorR, $minorR, $editR) = split('[/.-]', $requiredversion); if ($majorC > $majorR) return true; if ($majorC < $majorR) return false; // same major - check ninor if ($minorC > $minorR) return true; if ($minorC < $minorR) return false; //_and_same minor if ($editC>= $editR)return true; return true;} </PRE> {:6_265:}
页:
[1]