On Tue, Sep 25, 2001 at 09:00:18AM -0400, [EMAIL PROTECTED] wrote:
> 
> If I do this in PHP:
> 
> <?
>       $array = array();
> 
>       $array["foo"] = "bar";
>       $array["hey"] = "you";
>       $array["pink"]="floyd";
> 
>       myext_function($array);
> ?>
> 
> 
> How do I find all the keys and values out of that array in my extension? 
> Is there a way?

You can do something like:

if (zend_hash_find(Z_ARRVAL_PP(input), "pink", sizeof("pink"), (void **) &val) == 
SUCCESS) {
        convert_to_string_ex(val);
        ...
}

to look for pink, if you just want to iterate through the keys you can do
something like:

zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos);
while(zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&entry, &pos) == 
SUCCESS) {
        zend_hash_get_current_key_ex(Z_ARRVAL_PP(input), &string_key, &string_key_len, 
&num_key, 0, &pos)
        ...
}

See docs or sources for details/examples

Stig


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to