Doc #62586 [Opn->Asn]: version_compare, case sensitivity

From: Date: Fri, 20 Jul 2012 02:17:26 +0000
Subject: Doc #62586 [Opn->Asn]: version_compare, case sensitivity
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8591@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62586&edit=1 ID: 62586 Updated by: aharvey@php.net Reported by: dattaya108 at gmail dot com Summary: version_compare, case sensitivity -Status: Open +Status: Assigned Type: Documentation Problem -Package: *General Issues +Package: Documentation problem Operating System: Linux PHP Version: 5.3.14 -Assigned To: +Assigned To: aharvey Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2012-07-19 05:44:12] dattaya108 at gmail dot com And this: "This parameter is case-sensitive, so values should be lowercase". is probably about the parameter itself: var_dump(version_compare('2.1.0-dev', '2.1.0-dev', 'lt')); var_dump(version_compare('2.1.0-dev', '2.1.0-dev', 'LT')); bool(false) NULL ------------------------------------------------------------------------ [2012-07-19 05:33:04] dattaya108 at gmail dot com Yes, definitely, because without third parameter result is the same: var_dump(version_compare('2.1.0-DEV', '2.1.0-dev')); var_dump(version_compare('2.1.0-dev', '2.1.0-dev')); int(-1) int(0) ------------------------------------------------------------------------ [2012-07-18 19:51:51] mail+php at requinix dot net >Is there a page in the documentation that describes what's a "PHP-standardized" version number? The description block gives a fairly precise explanation for how version numbers are compared: after a couple character replacements, numeric parts are compared as numbers and non-numeric parts (eg, "alpha" and "rc") are compared according to a hierarchy. >hmm, you can strtolower before compare, I'd prefer this to be a doc problem.. The operator parameter says "This parameter is case-sensitive, so values should be lowercase". Maybe move that somewhere more obvious, like the description or a note? ------------------------------------------------------------------------ [2012-07-17 14:53:13] laruence@php.net hmm, you can strtolower before compare, I'd prefer this to be a doc problem.. ------------------------------------------------------------------------ [2012-07-17 11:09:14] dattaya108 at gmail dot com Wrong test script was provided. Right one: var_dump(version_compare('2.1.0-DEV', '2.1.0-dev', '<')); ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=62586 -- Edit this bug report at https://bugs.php.net/bug.php?id=62586&edit=1

« previous php.doc.bugs (#8591) next »