note 93188 deleted from function.fgetcsv by danbrown

From: Date: Mon, 21 Sep 2009 14:09:32 +0000
Subject: note 93188 deleted from function.fgetcsv by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-160888@lists.php.net to get a copy of this message
Note Submitter: k at vi1 dot co dot uk ---- A quick note regarding parsing long files, and using loops. DO NOT place the count function inside the loop arguments as it is re calculated at every occurance, so for instance // $array = array with 20,000 vals while ($i < count($array)) count() will get executed 20,000 times. To fix this just simply assign the value of count to a variable e.g. $total = count($array); while ($i<count($array)) This time there will be no overheads!

« previous php.notes (#160888) next »