note 65125 deleted from function.array-merge by bjori
| From: | bjori@php.net | Date: | Mon, 24 Apr 2006 20:31:03 +0000 |
| Subject: | note 65125 deleted from function.array-merge by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-109610@lists.php.net to get a copy of this message | ||
Note Submitter: magicianeer at yahoo dot com
----
Re: Johannes
You cannot casually replace
<?php $this->content = array_merge($this->content,$new_content); ?>
with this
<?php
foreach ($new_content as $piece) {
$this->content[] = $piece;
}
?>
because the foreach loop does Append, not a true Merge (thats why its faster). If $new_content
contains some of the same data as $this->content, then you will get duplicates.