jVersionComparator

class to compare version numbers. it supports the following keywords: "pre", "-dev", "b", "beta", "a", "alpha".

It supports also the "*" wilcard. This wilcard must be the last part of the version number

since 1.2
package

jelix

Methods

compareVersion

compareVersion( $version1,  $version2) : integer
static
Throws
\Exception

Arguments

$version1

$version2

Response

integer

0 if equal, -1 if $version1 < $version2, 1 if $version1 > $version2

getBranchVersion

getBranchVersion( $version) 
static

Arguments

$version

normalizeVersionNumber

normalizeVersionNumber( &$n) 
static

Arguments

$n

create a string representing a version number in a manner that it could be easily to be compared with an other serialized version. useful to do comparison in a database for example.

serializeVersion(string $version, integer $starReplacement, integer $pad = 4) : string
static
Throws
\Exception

Arguments

$version

string

$starReplacement

integer

1 if it should replace by max value, 0 for min value

$pad

integer

Response

string

the serialized version