Doc #54894 [Opn]: array copy semantics with references inside arrays

From: Date: Fri, 20 Jul 2012 00:21:05 +0000
Subject: Doc #54894 [Opn]: array copy semantics with references inside arrays
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8586@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=54894&edit=1 ID: 54894 Updated by: googleguy@php.net Reported by: mlvl dot jr at gmail dot com Summary: array copy semantics with references inside arrays Status: Open Type: Documentation Problem Package: Documentation problem Operating System: any PHP Version: Irrelevant Block user comment: N Private report: N New Comment: I'm not sure what the documentation problem is that you're reporting here. Could you please elaborate a bit more on what the bug is? Previous Comments: ------------------------------------------------------------------------ [2011-05-20 15:46:36] mlvl dot jr at gmail dot com Description: ------------ There probably should be an explicit reference to this: "While not being strictly an assignment by reference, expressions created with the language construct array() can also behave as such by prefixing & to the array element to add. The page also explains your why your first code behaves like it does: Note, however, that references inside arrays are potentially dangerous. Doing a normal (not by reference) assignment with a reference on the right side does not turn the left side into a reference, but references inside arrays are preserved in these normal assignments. This also applies to function calls where the array is passed by value." (taken from http://www.php.net/manual/en/language.references.whatdo.php) at the documentation page for 'array': http://php.net/manual/en/language.types.array.php [coming from http://stackoverflow.com/questions/6072444/php-array-copy-semantics-what-it-does-when-members-are-references-and-where-is/] ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=54894&edit=1

« previous php.doc.bugs (#8586) next »