Unclassified NewsBoard Code Reference

UnbCompareVersions function

Compare two version identifiers

function UnbCompareVersions ($v1, $v2, $ignoreBranch = false);

Parameters:

v1
(string) version 1
v2
(string) version 2
ignoreBranch  –  optional, default: false

Return value:

(int) -1: v1 < v2, 0: v1 = v2, 1: v1 > v2, false: not comparable

Remarks:

Version identifiers look like these:
unb.stable.1.6
unb.stable.1.6.1
unb.stable.1.6.patch.1
unb.stable.1.6.rc.1
unb.stable.1.6.beta.1
unb.stable.1.6.alpha.1
unb.stable.1.6.preview.1
unb.devel.20050914
EBNF definition:
<version-id> ::= <name> "." [ <branch> "." ]* <release>
<name> ::= non-numeric non-empty string
<branch> ::= non-numeric non-empty string
<release> ::= <subrelease> [ "." <subrelease> ]*
<subrelease> ::= "preview" | "alpha" | "beta" | "rc" | numeric non-empty string | "patch"

Implementation file: unb_lib/common.lib.php, line 3492

© 2006 Yves Goergen. Unclassified NewsBoard Homepage. Reference based on UNB unb.devel.20060128, dated 2006-01-28.