note 75686 deleted from function.version-compare by danbrown

From: Date: Sun, 20 Jul 2008 01:18:41 +0000
Subject: note 75686 deleted from function.version-compare by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-141904@lists.php.net to get a copy of this message
Note Submitter: opendb at iamvegan dot net ---- 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

« previous php.notes (#141904) next »