Re: [PHP4BETA] Extending PHP, Zend API

From: Date: Tue, 07 Mar 2000 19:55:13 +0000
Subject: Re: [PHP4BETA] Extending PHP, Zend API
References: 1 2 3 4 5  Groups: php.version4 
Request: Send a blank email to php-version4+get-11704@lists.php.net to get a copy of this message
On Tue, 07 Mar 2000, Paul S. Gumerman wrote: > What do I need to do to make an array that is created within my extension module > function have global scope (and persistance)? > > Here's the current code: > > > int read_response(zval *response) { > zval *arr; > . > . > . > > case LTARRAY: > MAKE_STD_ZVAL(arr); > array_init(arr); > > if (read_response(arr) == FAILURE) > return FAILURE; > > if (*varname) > zend_hash_update(response->value.ht, varname, strlen(varname) + 1, (void *) > &arr, sizeof(zval *), NULL); > else > zend_hash_next_index_insert(response->value.ht, &arr, sizeof(zval *), NULL); > break; > > Once I've got that right, do I need to do anything with the scalar objects I put in it > to make them persist until the script exits? If you use add_*() functions then they should set refcounts already. From the code you posted, everything seems fine, just use (void **) to cast &arr... -Andrei "C combines all the power of assembly language with all the ease of use of assembly language" -- trad

« previous php.version4 (#11704) next »