note 75686 added to function.version-compare
| From: | opendb at iamvegan dot net | Date: | Mon, 11 Jun 2007 20:26:45 +0000 |
| Subject: | note 75686 added to function.version-compare | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127403@lists.php.net to get a copy of this message | ||
My concern at this point, is that Hayley Watson's comments may confuse some people - it did me,
so I did some more investigation before replying...
According to all the unit tests (15) I have written using version_compare, I believe Hayley Watson
is incorrect. For example, all of these calls are true.
function testVersionBeta3ToBeta4()
{
$this->assertTrue(opendb_version_compare('1.0b3', '1.0a4',
'>'), '1.0b3 > 1.0a4');
}
function testVersionBeta6ToReleaseCandidate1()
{
$this->assertTrue(opendb_version_compare('1.0RC1', '1.0b6',
'>'), 'RC1 > 1.0b6');
}
So how is this any different (which does not return true)
function testVersion10pl1To101()
{
$this->assertTrue(opendb_version_compare('1.0.1', '1.0pl1',
'>'), '1.0.1 > 1.0pl1');
}
However when its changed to:
unction testVersion10pl1To101()
{
$this->assertTrue(opendb_version_compare('1.0.1', '1.0pl1',
'>'), '1.0.1 > 1.0.0pl1');
}
It works fine. I do believe that the version_compare function works as follows:
$version1 $operator $version2
----
Server IP: 203.202.10.60
Probable Submitter: 202.7.176.130 (proxied: 60.240.112.111)
----
Manual Page -- http://www.php.net/manual/en/function.version-compare.php
Edit -- https://master.php.net/note/edit/75686
Del: integrated -- https://master.php.net/note/delete/75686/integrated
Del: useless -- https://master.php.net/note/delete/75686/useless
Del: bad code -- https://master.php.net/note/delete/75686/bad+code
Del: spam -- https://master.php.net/note/delete/75686/spam
Del: non-english -- https://master.php.net/note/delete/75686/non-english
Del: in docs -- https://master.php.net/note/delete/75686/in+docs
Del: other reasons-- https://master.php.net/note/delete/75686
Reject -- https://master.php.net/note/reject/75686
Search -- https://master.php.net/manage/user-notes.php