|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2021-10-21 14:17 UTC] cmb@php.net
 | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 00:00:01 2025 UTC | 
Description: ------------ Not very important, I'm dropping this findings here so they don't get lost in the meanders of web. These operations (and similar ones) don't require a copy to be performed as the result is identical to the original. Test script: --------------- $foo = str_repeat('foo', 100000); var_dump(memory_get_usage()); $baz = '' . $foo; // $baz is identical to $foo var_dump(memory_get_usage()); unset($foo, $baz); echo "\n"; $foo = array_fill(0, 1000, 'foo'); var_dump(memory_get_usage()); $baz = array_merge($foo, []); // $baz is identical to $foo var_dump(memory_get_usage()); unset($foo, $baz); echo "\n"; $foo = array_fill(0, 1000, 'foo'); var_dump(memory_get_usage()); $baz = array_slice($foo, 0); // $baz is identical to $foo var_dump(memory_get_usage()); // etc...