Brad LaFountain <[EMAIL PROTECTED]> writes:
> PHP_FUNCTION(ref_assign) > { > zval *bar, *foo; > > if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &bar, &foo) == > FAILURE) { > return; > } > > ZVAL_ADDREF(foo); > *bar = *foo; > bar->is_ref = TRUE; > bar->refcount = 1; > } > > this works, but i don't know if its the best way to do it. > Thanks, but it doesn't actually work for me. Witness: [tim@myst php-4.2.3]$ ./php -f ext/foo/foo.php foo foo baz -*- ^@\204Í FATAL: erealloc(): Unable to allocate 1515870811 bytes Segmentation fault (core dumped) [tim@myst php-4.2.3]$ ext/foo/foo.php contains: <? if(!extension_loaded('foo')) { dl('foo.so'); } //make two variables $foo = "foo"; $bar = "zonk"; //reference assignment $bar =& $foo; //should be identical echo "$foo\n"; echo "$bar\n"; //set foo and bar to "baz" $bar = "baz"; //should print "baz" echo "$foo\n"; echo "-*-\n"; //make two variables $wibb = "foo"; $wobb = "zonk"; //reference assignment ref_assign($wobb, $wibb); //set wibb and wobb to "baz" echo "$wibb\n"; echo "$wobb\n"; //should print "baz" $wobb = "baz"; echo "$wibb\n"; ?> -Tim -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php