note 90572 added to class.iterator

From: Date: Tue, 28 Apr 2009 21:13:35 +0000
Subject: note 90572 added to class.iterator
Groups: php.notes 
Request: Send a blank email to php-notes+get-153949@lists.php.net to get a copy of this message
The example for() loops below are incorrect. If you want to emulate a foreach() loop with a for loop it should be writtin as: <php? for ($I->rewind(); $I->valid(); $I->next()) { $value = $I->current(); $key = $I->key(); } ?> This way it correctly matches the function call order that a foreach() loop does. ---- Server IP: 91.199.167.18 Probable Submitter: 80.126.100.119 ---- Manual Page -- http://www.php.net/manual/en/class.iterator.php Edit -- https://master.php.net/note/edit/90572 Del: integrated -- https://master.php.net/note/delete/90572/integrated Del: useless -- https://master.php.net/note/delete/90572/useless Del: bad code -- https://master.php.net/note/delete/90572/bad+code Del: spam -- https://master.php.net/note/delete/90572/spam Del: non-english -- https://master.php.net/note/delete/90572/non-english Del: in docs -- https://master.php.net/note/delete/90572/in+docs Del: other reasons-- https://master.php.net/note/delete/90572 Reject -- https://master.php.net/note/reject/90572 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#153949) next »