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

From: Date: Sat, 19 Aug 2000 21:42:20 +0000
Subject: 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-29721@lists.php.net to get a copy of this message
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 No. You have "get_value_from" and "to_merge_with" names pointing to the same zval. Tmp is another zval. You've lost here zval "get_value_from" was pointing to. You have now no idea what it was. AL>> $get_value_from=$tmp; } // restore the value Here you copy zval that was in tmp to zval "get_value_from" is pointing to (that was the same zval as "to_merge_with" was pointing to). You could do the same with just: $to_merge_with = $get_value_from; AL>> so far we╢ve reached *everything* we wanted to do, *without* AL>> "knowing which variable in which symbol table user had that is AL>> linked to variable" we╢ve linked *all* variables and assigned AL>> them "foreign"-value What did you want to do? Copy one zval to another? There's much more simple way to do this. If you meant to copy references, you didn't do that. -- Stanislav Malyshev stas@zend.com +972-3-6139665 ext.106

« previous php.dev (#29721) next »