Doc #54696 [Opn->Csd]: Error: If low > high, the sequence will be from high to low

From: Date: Tue, 24 May 2011 20:22:40 +0000
Subject: Doc #54696 [Opn->Csd]: Error: If low > high, the sequence will be from high to low
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-6653@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=54696&edit=1 ID: 54696 Updated by: salathe@php.net Reported by: Andy at Azurite dot co dot uk Summary: Error: If low > high, the sequence will be from high to low -Status: Open +Status: Closed Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant -Assigned To: +Assigned To: salathe Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Low/high has been changed to start/limit. Hopefully that clarifies things a little. Previous Comments: ------------------------------------------------------------------------ [2011-05-24 22:14:38] salathe@php.net Automatic comment from SVN on behalf of salathe Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=311397 Log: clarify range() parameter purposes (doc #54696) ------------------------------------------------------------------------ [2011-05-09 16:51:04] Andy at Azurite dot co dot uk Description: ------------ --- From manual page: http://www.php.net/function.range#Return Values --- The description of a decrementing range is at best ambiguous, at worst wrong: "If low > high, the sequence will be from high to low." Having defined 'low' to be the first arg and 'high' to be the 2nd arg, it is reasonable, though potentially confusing to consider "low > high" (confusing because 'low' is actually higher than 'high' in natural language). However to then state that the sequence is from 'high' (the smaller value) to 'low' (the greater value) is wrong. It would be much better if the names low and high were completely replaced with 'first' and 'last' (or maybe 'limit', to account for ranges that don't exactly divide by the increment). This would be semantically correct in both the ascending and descending case and completely unambiguous. It would even be semantically better in terms of inclusivity where the comparison with the common zero-based form of 'for' loop might lead us to expect the top value to be exclusive: for ($x=0; $x<10; $x++) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=54696&edit=1

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