#20394 [Opn->Asn]: prev(), next(), current(), end() should say 'value' rather than 'element'
| From: | moriyoshi@php.net | Date: | Sun, 11 May 2003 13:37:30 +0000 |
| Subject: | #20394 [Opn->Asn]: prev(), next(), current(), end() should say 'value' rather than 'element' | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969353339@lists.php.net to get a copy of this message | ||
ID: 20394
Updated by: moriyoshi@php.net
Reported By: phpbugs at priorwebsites dot com
-Status: Open
+Status: Assigned
Bug Type: Documentation problem
PHP Version: 4.3.0-pre2
Assigned To: k.schroeder
Previous Comments:
------------------------------------------------------------------------
[2002-11-12 10:31:58] phpbugs at priorwebsites dot com
In the array documentation for current(), prev(), next(), end(), it
should use the word 'value' wherever it means the value in the
key=>value pair, and not the word element.
I was struggling to understand what the array functions prev() and
next() return, as I rarely use them, since each() normally does what is
needed. I understand well when the array documentation talks about
'key' and 'value', but here was a seemingly new concept to me,
'element'. At one stage I thought it must return the same as each(),
i.e. the $key=>$value pair, though comparing the datatypes returned
disproved this theory. Finally, I deduced from the documentation for
current() which talks about when the value is 0 or "", that what is
returned is what is normally referred to in the array documentation as
'value'.
It should not require such detective work!!
Maybe an example in, say, prev(), would make it all clear:
$transport = {'foot', 'bike', 'car', 'plane'}
$mode = current($transport); // $mode = 'foot';
$mode = next($transport); // $mode = 'bike';
$mode = next($transport); // $mode = 'car';
$mode = prev($transport); // $mode = 'bike' again
$mode = end($transport); // $mode = 'plane'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20394&edit=1