destructing and creating value of parameter passed by reference
| From: | Stig Venaas | Date: | Mon, 16 Oct 2000 14:20:25 +0000 |
| Subject: | destructing and creating value of parameter passed by reference | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-35127@lists.php.net to get a copy of this message | ||
I'm writing a function where I want to return a value in a parameter.
Right now I'm just doing:
PHP_FUNCTION(ldap_get_option) {
LDAP *ldap;
pval **link, **option, **retval;
int opt;
if (ZEND_NUM_ARGS() != 3 ||
zend_get_parameters_ex(3, &link, &option, &retval) == FAILURE) {
WRONG_PARAM_COUNT;
}
and then
(*retval)->type = IS_LONG;
(*retval)->value.lval = val;
I suppose I should destruct the old pval (pval_destruct()?) and somehow
create a new, what's the best way?
I'm sure someone will tell me to return the value the normal way, but
I want to return success/failure that way, and think this is cleaner.
Stig