Recently I have stumbled upon a case where my Drupal installation exceeded 128 MB of PHP memory, because I have used array_merge() in a loop. PHPStorms EA extended plugin reports that array_merge() is a resources greedy construction, when used in a loop. Therefor it's good to replace such usages.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3044373-array_merge_loop.patch | 639 bytes | jepster_ |
Comments
Comment #2
jepster_Comment #5
steven.wichers commentedThe attached patch changes the functionality. array_merge and += are functionally different. Here's a simple example to demonstrate:
Result:
Note the difference in the foo and fizz items.
Comment #9
mxr576Closing this in favor of #3266568 that addresses this problem too.
Comment #10
mxr576