Bitrix Site Manager

CheckVersion

bool
CheckVersion(
 string version1,
 string version2
)

The function CheckVersion compares versions in the format XX.XX.XX. Returns true, is the version number passed in version1 is greater or equal to the second version number passed version2, or false otherwise.

Parameters

ParameterDescription
version1 First version to be compared in the format "XX.XX.XX"
version2 Second version to be compared in the format "XX.XX.XX"

Example



<?
$ver1 = "3.0.15";
$ver2 = "4.0.0";

$res = CheckVersion($ver1, $ver2);

echo ($res) ? $ver1." >= ".$ver2 : $ver1." < ".$ver2; 

// output: 3.0.15 < 4.0.0
?>