note 98794 added to function.array-merge
| From: | Jase at osu1 dot php dot net | Date: | Thu, 08 Jul 2010 11:25:15 +0000 |
| Subject: | note 98794 added to function.array-merge | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-170782@lists.php.net to get a copy of this message | ||
jpakin at gmail dot com
In your example you implying a while would be faster. If your using PHP5, this is not the case. For
large memory arrays, it's MUCH faster and more efficient to use a reference in a foreach
<?php
$large_array = array(.......);
/* use reference when retrieving value */
foreach($large_array as $key => &$value){
$value is not a reference
}
unset($value); //unset this else an incorrect use of this variable later may cause undesired effects
?>
----
Server IP: 69.147.83.197
Probable Submitter: 91.84.158.217
----
Manual Page -- http://www.php.net/manual/en/function.array-merge.php
Edit -- https://master.php.net/note/edit/98794
Del: integrated -- https://master.php.net/note/delete/98794/integrated
Del: useless -- https://master.php.net/note/delete/98794/useless
Del: bad code -- https://master.php.net/note/delete/98794/bad+code
Del: spam -- https://master.php.net/note/delete/98794/spam
Del: non-english -- https://master.php.net/note/delete/98794/non-english
Del: in docs -- https://master.php.net/note/delete/98794/in+docs
Del: other reasons-- https://master.php.net/note/delete/98794
Reject -- https://master.php.net/note/reject/98794
Search -- https://master.php.net/manage/user-notes.php