Re: trying to understand zvals

From: Date: Thu, 17 Oct 2002 15:30:23 +0000
Subject: Re: trying to understand zvals
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-89659@lists.php.net to get a copy of this message
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. - Brad --- "Tim Daly, Jr." <tim@tenkan.org> wrote: > > I'm trying to do some extension programming, and I'm pretty confused > by the whole zval thing. In particular, references are a little > mysterious. If I have > > $foo = "zonk"; > $bar =& $foo; > > in PHP, what actually happens? Specifically, if I wanted a function > that did such a reference assignment: > > $foo = "zonk"; > $bar = "baz"; > > ref_assign($bar, $foo); // $bar =& $foo; > > what has to happen in ref_assign? > > Thanks, > Tim > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, visit: http://www.php.net/unsub.php > __________________________________________________ Do you Yahoo!? Faith Hill - Exclusive Performances, Videos & More http://faith.yahoo.com

« previous php.dev (#89659) next »