Uhhh sorry!

What I should have said is that... The associative array I wish to
return is to be an array element of .... an associative array ;)
Meaning... I need the functionality of add_assoc_array but since
this function doesn't exist - I have to manipulate with the
zend_hash_xxx in order to get what I want - but I fail to connect
my constructed array with a name... 

Rasmus Lerdorf wrote:
> 
> > I was wondering if someone would be so nice as to post a code
> > snippet that returns an associative array... I'm writing an
> > extension and am only able to return an ordinary array...
> > Alternatively I would be very interested if someone could
> > point me to some documentation on the zend_hash_xxx functions
> 
> array_init(return_value);
> add_assoc_string(return_value, "string index", your_char_var, 1);
> add_assoc_double(return_value, "another one", your_long_var);
> 
> That's all.  Last arg on add_assoc_string() should be 1 if you need to
> make a copy of the string.  If the char * you are passing was allocated by
> you using emalloc() then don't make a copy.
> 
> You don't need any zend_hash_xxx functions to just return an associative
> array.
> 
> -Rasmus


-- 
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