cvs: phpdoc /en/language references.xml

From: Date: Mon, 26 Jul 2004 20:53:57 +0000
Subject: cvs: phpdoc /en/language references.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969362196@lists.php.net to get a copy of this message
vrana Mon Jul 26 16:53:57 2004 EDT Modified files: /phpdoc/en/language references.xml Log: References with complex arrays (bug #17959) http://cvs.php.net/diff.php/phpdoc/en/language/references.xml?r1=1.30&r2=1.31&ty=u Index: phpdoc/en/language/references.xml diff -u phpdoc/en/language/references.xml:1.30 phpdoc/en/language/references.xml:1.31 --- phpdoc/en/language/references.xml:1.30 Mon Jul 26 16:38:58 2004 +++ phpdoc/en/language/references.xml Mon Jul 26 16:53:56 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.30 $ --> +<!-- $Revision: 1.31 $ --> <chapter id="language.references"> <title>References Explained</title> @@ -115,6 +115,32 @@ Think about <literal>global $var;</literal> as a shortcut to <literal>$var =&amp; $GLOBALS['var'];</literal>. Thus assigning other reference to <literal>$var</literal> only changes the local variable's reference. + </para> + </warning> + <warning> + <para> + Complex arrays are sometimes rather copied than referenced. Thus following + example will not work as expected. + <example> + <title>References with complex arrays</title> + <programlisting role="php"> +<![CDATA[ +<?php +$top = array( + 'A' => array(), + 'B' => array( + 'B_b' => array(), + ), +); + +$top['A']['parent'] = &$top; +$top['B']['parent'] = &$top; +$top['B']['B_b']['data'] = 'test'; +print_r($top['A']['parent']['B']['B_b']); // array() +?> +]]> + </programlisting> + </example> </para> </warning> <para>

« previous php.doc (#969362196) next »