note 43635 deleted from function.array-keys by aidan

From: Date: Sun, 26 Sep 2004 00:48:46 +0000
Subject: note 43635 deleted from function.array-keys by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-77352@lists.php.net to get a copy of this message
Note Submitter: fred at forsalebyowner dot com ---- I can't take it...code like this: //Assign $array up here for($j = 0; $j < count($array); $j++) { //Do stuff } Is horribly broken. Don't do that...bad monkey. count($array) is generally loop invariant. Do $len = count($array); for($j = 0; $j < $len; $j++) { //Do stuff } If count($array) is not loop inviant then change it by the same amount that $array is changed

« previous php.notes (#77352) next »