note 48214 deleted from control-structures.foreach by aidan

From: Date: Sat, 12 Mar 2005 00:40:27 +0000
Subject: note 48214 deleted from control-structures.foreach by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-86315@lists.php.net to get a copy of this message
Note Submitter: caliban at darklock dot com ---- Many old code examples dating back to PHP3 use this construct: while(list($x,$y)=each($a)) {...} However, on PHP4 and PHP5, you have this construct: foreach($a as $x=>$y) {...} The latter construct is almost twice as fast as the former, with the usual caveats about architecture and compiler and whatnot having an effect.

« previous php.notes (#86315) next »