Bug #15488: Bug in foreach example?

From: Date: Sun, 10 Feb 2002 15:47:23 +0000
Subject: Bug #15488: Bug in foreach example?
Groups: php.bugs php.doc 
Request: Send a blank email to php-bugs+get-63@lists.php.net to get a copy of this message
From: saajan@saajmin.f9.co.uk Operating system: Windows XP PHP version: 4.1.1 PHP Bug Type: Documentation problem Bug description: Bug in foreach example? I was looking through a php manual that I downloaded yesterday (php_manual_en.pdf.zip) and noticed what looks like an error on page 149 (PDF page 216). Right at the bottom of the page, there is a foreach() usage example. Example 2 is as follows: /* 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) { print "\$a[$i] => $v.\n"; } But $i will always be 0, as it is never modified in the loop! I found the same error in the online manual at http://www.php.net/manual/en/control-structures.foreach.php -- Edit bug report at http://bugs.php.net/?id=15488&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=15488&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=15488&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=15488&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=15488&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=15488&r=support Expected behavior: http://bugs.php.net/fix.php?id=15488&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=15488&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=15488&r=submittedtwice

« previous php.bugs (#63) next »