[PHP-DEV] Re: re-referencing and how we could enable this *without* pointers From: Stanislav Malyshev (stas <email protected>)
Date: 08/19/00

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 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 <email protected>          
+972-3-6139665 ext.106

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>