Version::compare()

static bool compare(string $version1, string $version2, string $operator, int|null $precision = null)

Compares two versions with an operator.

This method is identical to {@link version_compare()}, except that you can pass the number of regarded version components in the last argument $precision.

Examples:

Version::compare('1.2.3', '1.2.4', '==')
// => false

Version::compare('1.2.3', '1.2.4', '==', 2)
// => true

Parameters

string $version1 A version string
string $version2 A version string to compare
string $operator The comparison operator
int|null $precision The number of components to compare. Pass NULL to compare the versions unchanged.

Return Value

bool Whether the comparison succeeded

See also

normalize()
doc_Symfony
2016-10-28 06:37:04
Comments
Leave a Comment

Please login to continue.