note 32401 deleted from function.version-compare by aidan
| From: | aidan@php.net | Date: | Fri, 07 Oct 2005 23:55:01 +0000 |
| Subject: | note 32401 deleted from function.version-compare by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96587@lists.php.net to get a copy of this message | ||
Note Submitter: judgej at xaraya dot com
----
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.