Name
version_compare
Synopsis
int version_compare(stringone
, stringtwo
[, stringoperator
])
Compares two strings of the format
“4.1.0” and returns
-1
if one
is less than
two
, 0
if they are
equal, and 1
if one
is
greater than two
. 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
.
Get Programming PHP now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.