note 50097 added to function.array
| From: | rdude at fuzzelish dot com | Date: | Thu, 17 Feb 2005 21:35:56 +0000 |
| Subject: | note 50097 added to function.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-85183@lists.php.net to get a copy of this message | ||
If you are creating an array with a large number of static items, you will find serious performance
differences between using the array() function and the $array[] construct. For example:
<?
// Slower method
$my_array = array(1, 2, 3,
500);
// Faster method
$my_array[] = 1;
$my_array[] = 2;
$my_array[] = 3;
$my_array[] = 500;
?>
----
Manual Page -- http://www.php.net/manual/en/function.array.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50097
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50097&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50097&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50097&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50097&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50097&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50097&report=yes
Search -- http://master.php.net/manage/user-notes.php