note 104085 deleted from control-structures.foreach by googleguy

From: Date: Wed, 14 Nov 2012 22:21:28 +0000
Subject: note 104085 deleted from control-structures.foreach by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-191946@lists.php.net to get a copy of this message
Note Submitter: gcocatre at gmail dot com ---- The following code produces an unexpected result: <?php $a = array ('zero', 'one', 'two', 'three'); foreach ($a as $key => $value) echo "$key: $value\n"; var_dump(key($a)); /* Produces: 0: zero 1: one 2: two 3: three int(1) */ ?> Reset your array after using foreach on it!

« previous php.notes (#191946) next »