note 24853 added to control-structures.foreach

From: Date: Fri, 30 Aug 2002 09:28:02 +0000
Subject: note 24853 added to control-structures.foreach
Groups: php.notes 
Request: Send a blank email to php-notes+get-36029@lists.php.net to get a copy of this message
It seams that foreach() DOES move the array pointer! <?php $a = array(1,2,3,4); foreach($a as $var) print $var; print current($a); ?> current() prints nothing in php 4.2.2 where it should print 1. comment out the foreach() line and current() prints 1. dunno how other php versions handle this -- http://www.php.net/manual/en/control-structures.foreach.php http://master.php.net/manage/user-notes.php?action=edit+24853 http://master.php.net/manage/user-notes.php?action=delete+24853 http://master.php.net/manage/user-notes.php?action=reject+24853

« previous php.notes (#36029) next »