#43837 [NEW]: Unclear Example in Control Structures foreach
| From: | php at wallbash dot com | Date: | Mon, 14 Jan 2008 10:52:13 +0000 |
| Subject: | #43837 [NEW]: Unclear Example in Control Structures foreach | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-442@lists.php.net to get a copy of this message | ||
From: php at wallbash dot com
Operating system:
PHP version: Irrelevant
PHP Bug Type: Documentation problem
Bug description: Unclear Example in Control Structures foreach
Description:
------------
I think this was introduced with #15488.
It states
"/* foreach example 2: value (with key printed for illustration) */"
but the example doesn't really print that key.
Thanks
Reproduce code:
---------------
http://www.php.net/manual/en/control-structures.foreach.php
Expected result:
----------------
/* foreach example 2: value (with key printed for illustration) */
$a = array(1, 2, 3, 17);
foreach ($a as $i => $v) {
echo "\$a[$i] => $v.\n";
}
Actual result:
--------------
/* foreach example 2: value (with key printed for illustration) */
$a = array(1, 2, 3, 17);
$i = 0; /* for illustrative purposes only */
foreach ($a as $v) {
echo "\$a[$i] => $v.\n";
$i++;
}
--
Edit bug report at http://bugs.php.net/?id=43837&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43837&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43837&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43837&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43837&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43837&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=43837&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43837&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43837&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43837&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43837&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43837&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=43837&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=43837&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43837&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43837&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43837&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43837&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43837&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43837&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43837&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43837&r=mysqlcfg