Jelix 1.6.40

jVersionComparator
in package

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

Tags
since
1.2

Table of Contents

compareVersion()  : int
getBranchVersion()  : mixed
serializeVersion()  : string
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.
normalizeVersionNumber()  : mixed

Methods

compareVersion()

public static compareVersion( $version1,  $version2) : int
Parameters
$version1 :
$version2 :
Tags
throws
Exception
Return values
int

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

getBranchVersion()

public static getBranchVersion(mixed $version) : mixed
Parameters
$version : mixed
Return values
mixed

serializeVersion()

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.

public static serializeVersion(string $version, int $starReplacement[, int $pad = 4 ]) : string
Parameters
$version : string
$starReplacement : int

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

$pad : int = 4
Tags
throws
Exception
Return values
string

the serialized version

normalizeVersionNumber()

protected static normalizeVersionNumber(mixed &$n) : mixed
Parameters
$n : mixed
Return values
mixed

Search results