Hi,

I am still stuck with my extension module. I'm not able to implement a 
function which returns a reference to an already existing variable. All I 
want to do is to write a function like this in C:

  function &return_reference() {
    global $a;

    return $a;
  }

The only possibility I found is to do something like that:

  *return_value=*other_variable;
  ZVAL_ADDREF(other_variable);

This seems to work but I think it can't be correct, because "return_value" 
now isn't really a  reference to "other_variable".  Both are pointing to the 
same value but not to the same zval-Container. So both variables have an own 
refcount. I have the bad feeling that this might lead to a crash.

Please help me. I just need to know, how to write a ZEND_FUNCTION which 
returns a reference to a variable like the PHP-Function above.  Or is there 
an already existing function in PHP which is doing something like this and 
which I can use as an example how to do it?

-- 
Bye, K <http://www.ailis.de/~k/>
[A735 47EC D87B 1F15 C1E9  53D3 AA03 6173 A723 E391]
(Finger [EMAIL PROTECTED] to get public key)

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to