note 50994 added to language.references
| From: | nslater at gmail dot com | Date: | Wed, 16 Mar 2005 03:12:47 +0000 |
| Subject: | note 50994 added to language.references | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-86508@lists.php.net to get a copy of this message | ||
In addition to the note made by "Francis dot a at gmx dot net" you should not normally be
using a function such as sizeof() or count() in a control structure such as FOR because the same
value is being calculated repeatedly for each iteration. This can slow things down immensely,
regardless of whether you pass by value or reference.
It is generally much better to calculate the static values before the defining the looping control
structure.
Example:
<?php
$intSize = sizeof($arrData);
for($i = 0; $i < $intSize; $n++) {
// Do stuff
}
?>
----
Manual Page -- http://www.php.net/manual/en/language.references.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50994
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50994&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50994&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50994&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50994&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50994&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50994&report=yes
Search -- http://master.php.net/manage/user-notes.php