note 66721 deleted from control-structures.foreach by bjori

From: Date: Sat, 27 May 2006 15:19:53 +0000
Subject: note 66721 deleted from control-structures.foreach by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-112359@lists.php.net to get a copy of this message
Note Submitter: bdnt at gmx dot net Reason: bad code ---- i suggest, DO NOT USE the second syntax <?php foreach ($arr $key=>$val) { } ?> if in the future you use mmcache (for encoded or optimization) you'll come in serious error. mmcache seems always look the array as numerical's index not as associative array. Better use this syntax <?php foreach (array_keys($arr) as $key) { $val = $arry[$key]; } ?> This script will be executed much faster (please do the benchmark yourself) and mmcache will be correctly interpret by mmcache.

« previous php.notes (#112359) next »