Re: zend_parse_parameters

From: Date: Fri, 07 Sep 2001 20:00:33 +0000
Subject: Re: zend_parse_parameters
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-65381@lists.php.net to get a copy of this message
On Fri, 07 Sep 2001, Wez Furlong wrote: > How about a new zend function that will parse values, much like > zend_parse_parameters does, except that it operates on a hash and allows > you to specify the keys of the hash: > > my_zval = array( > "firstname" => "fred", > "lastname" => "bloggs", > "age" => 42 > ); > > char * firstname = NULL; long firstname_len; > char * lastname = NULL; long lastname_len; > long age = 0; > > zend_parse_parameters_hash(HASH_OF(my_zval), > // mandatory string value with key "firstname" > "s%firstname", &firstname, &firstname_len, > // optional string value with key "lastname" > "|s%lastname", &lastname, &lastname_len, > // mandatory long value with key "age" > "l%age", &age > NULL > ); > > Any thoughts? If this is implemented (I think Andi may have some thoughts about this), then why not: zend_parse_parameters_hash(HASH_OF(my_zval), "{s:firstname}|{s:lastname}{l:age}", &firstname, &firstname_len, &lastname, &lastname_len, &age); -Andrei Some people try to achieve immortality through their work, others through their children. I hope to achieve immortality by not dying. -- Woody Allen

« previous php.dev (#65381) next »