Re: [PHP-DEV] zend_parse_parameters From: Andrei Zmievski (andrei <email protected>)
Date: 09/07/01

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

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>