note 32401 modified in function.version-compare by cellog
| From: | cellog@php.net | Date: | Wed, 27 Aug 2003 00:12:11 +0000 |
| Subject: | note 32401 modified in function.version-compare by cellog | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-55147@lists.php.net to get a copy of this message | ||
The examples given all assume the version numbers consist of exactly three integers. This, however,
is not a strict rule.
version_compare() will work correctly when the version numbering goes down to deeper levels, and
also when the levels between the two versions being compared differ. So 1.2 will correctly be shown
to be a higher version than 1.1.9.8 which in turn is higher than 1.1.9.7.
In addition, if a level contains a non-numeric character, then a string comparison is performed on
that level rather than a numeric comparison.
I don't know what the limits are, but it looks to be broad enough to use in most practical
situations. I've tested this on PHP 4.1.2.
--was--
The examples given all assume the version numbers consist of exactly three integers. This, however,
is not a strict rule.
compare_versions() will work correctly when the version numbering goes down to deeper levels, and
also when the levels between the two versions being compared differ. So 1.2 will correctly be shown
to be a higher version than 1.1.9.8 which in turn is higher than 1.1.9.7.
In addition, if a level contains a non-numeric character, then a string comparison is performed on
that level rather than a numeric comparison.
I don't know what the limits are, but it looks to be broad enough to use in most practical
situations. I've tested this on PHP 4.1.2.
http://www.php.net/manual/en/function.version-compare.php