Re: [PHP4BETA] can we support $a = array("text" => &$text)?

From: Date: Fri, 01 Oct 1999 10:43:24 +0000
Subject: Re: [PHP4BETA] can we support $a = array("text" => &$text)?
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-5060@lists.php.net to get a copy of this message
Yes, you're correct. This is how it works. The copy constructor keeps references in place and doesn't duplicate the values. Andi At 12:13 PM 10/1/99 +0200, Thies C. Arntzen wrote:
works! we have a litte feature/problem with references in arrays though - maybe we should document it! script: <? $text = "clever"; $thies = array(&$text); function check_iq($a) { $a[ 0 ] = "stupid"; } var_dump($text); check_iq($thies); // note that we dont "pass-by-reference" var_dump($text); ?> shows: ./php ../arrayref.php Content-Type: text/html string(6) "clever" string(6) "stupid" so "once-by-reference" means "always-by-reference" - i can live with that - i actually like it - tc On Fri, 1 Oct 1999, Andi Gutmans wrote: Your wish is my command. I just implemented it and am commiting it to the Zend tree. Please mess around with it a bit and see if it works well. Andi At 08:40 PM 9/29/99 +0200, Thies C. Arntzen wrote:
right now one would have to write: $a = array(); $a["text"]=&$text; just an idea - (i know we spoke about it some month ago) tc -- PHP 4 Beta
--- Andi Gutmans <andi@zend.com> http://www.zend.com/
Thies C. Arntzen                 "One Big-Mac, Small Fries and a Coke!"
Digital Collections             Phone +49 40 235350 Fax +49 40 23535180
Hammerbrookstr. 93                              20097 Hamburg / Germany
--- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.version4 (#5060) next »