note 32401 added to function.version-compare
| From: | judgej at xaraya dot com | Date: | Tue, 27 May 2003 01:13:57 +0000 |
| Subject: | note 32401 added to function.version-compare | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-49055@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.
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.
----
Manual Page -- http://www.php.net/manual/en/function.version-compare.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32401
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32401&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32401&report=yes