O'Reilly logo

Programming PHP, 3rd Edition by Peter MacIntyre, Kevin Tatroe, Rasmus Lerdorf

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

version_compare

Synopsis

mixed version_compare(string one, string two[, string operator])

Compares two version strings and returns −1 if one is less than two, 0 if they are equal, and 1 if one is greater than two. The version strings are split into each numeric or string part, then compared as string_value < "dev" < "alpha" or "a" < "beta" or "b" < "rc" < numeric_value < "pl" or "p".

If operator is specified, the operator is used to make a comparison between the version strings, and the value of the comparison using that operator is returned. The possible operators are < or lt; <= or le; > or gt; >= or ge; ==, =, or eq; and !=, <>, and ne.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required