note 35183 added to control-structures.foreach
| From: | jon at nospam dot com | Date: | Fri, 22 Aug 2003 14:05:18 +0000 |
| Subject: | note 35183 added to control-structures.foreach | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-54871@lists.php.net to get a copy of this message | ||
Apparently the internal array pointer is <i>not</i> incremented on the original array as
the Note in the documentation for foreach says.
<?php
$someArray = Array( "1", "2", "3", "4" );
foreach( $someArray AS $curNum )
echo $curNum . " / " . current( $someArray ) . "\n";
?>
Will produce:
1 / 1
2 / 1
3 / 1
4 / 1
----
Manual Page -- http://www.php.net/manual/en/control-structures.foreach.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35183
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35183&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35183&report=yes