Re: Re: re-referencing and how we could enable this *without* pointers

From: Date: Sat, 19 Aug 2000 23:20:46 +0000
Subject: Re: Re: re-referencing and how we could enable this *without* pointers
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-29749@lists.php.net to get a copy of this message
AL>> <?php AL>> function &re_link(&$to_merge_with,&$get_value_from) { AL>> $tmp=$get_value_from; // save value AL>> $get_value_from=&$to_merge_with; // now you╢ve linked all the three but lost the AL>> value AL>> $get_value_from=$tmp; // restore the value AL>> return $get_value_from; AL>> } So, you again copied zval that $get_value_from was pointing to into zval that $to_merge_with was pointing to. This could be done with simple assignment. Then you returned reference to zval that $to_merge_with was pointing to. You didn't copy any references. Believe me, you cannot do it that way. You can copy values using references, but that never was problematic. The problem is that you cannot "copy references" themselves. If you would live in the neigbourhood, I could invite you here and draw it on the board, because email seems to be not clean enough medium to explain this. :) Maybe I'll draw some pictures tomorrow. -- Stanislav Malyshev stas@zend.com +972-3-6139665 ext.106

« previous php.dev (#29749) next »