note 19408 added to control-structures.while

From: Date: Tue, 26 Feb 2002 19:42:38 +0000
Subject: note 19408 added to control-structures.while
Groups: php.notes 
Request: Send a blank email to php-notes+get-27083@lists.php.net to get a copy of this message
At the end of the while (list / each) loop the array pointer will be at the end. This means the second while loop on that array will be skipped! You can put the array pointer back with the reset($myArray) function. example: $myArray=array('aa','bb','cc','dd'); while (list ($key, $val) = each ($myArray) ) echo $val; reset($myArray); while (list ($key, $val) = each ($myArray) ) echo $val; -- http://www.php.net/manual/en/control-structures.while.php http://master.php.net/manage/user-notes.php?action=edit+19408 http://master.php.net/manage/user-notes.php?action=delete+19408 http://master.php.net/manage/user-notes.php?action=reject+19408

« previous php.notes (#27083) next »