Bug #15488 Updated: Bug in foreach example?

From: Date: Sun, 10 Feb 2002 15:49:36 +0000
Subject: Bug #15488 Updated: Bug in foreach example?
References: 1  Groups: php.bugs php.doc 
Request: Send a blank email to php-bugs+get-64@lists.php.net to get a copy of this message
ID: 15488 Updated by: derick@php.net Reported By: saajan@saajmin.f9.co.uk -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Windows XP PHP Version: 4.1.1 New Comment: This bug has been fixed in CVS. Previous Comments: ------------------------------------------------------------------------ [2002-02-10 10:47:22] saajan@saajmin.f9.co.uk 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 this bug report at http://bugs.php.net/?id=15488&edit=1

« previous php.bugs (#64) next »