It seems really inefficient that in PHP, when an array is assigned by value all of its internal elements are recursively copied to the new variable. Is this what really happens internally?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
No, the internally array is not deep-copied on assignment. Consider the following snippet:
If a picture is worth a thousand words, then here is what happens internally when arrays are assigned and then their array elements are modified: