I was just kidding, really. I'm using the docs there all day long
..
But his neested example was just nice.
- Markus
On Mon, Aug 13, 2001 at 12:38:18PM +0300, Zeev Suraski wrote :
> Actually, this is quite well documented, if you actually try to look the
> documentation up...
>
> http://www.zend.com/apidoc/x1243.php
>
> Zeev
>
> At 12:24 13-08-01, Markus Fischer wrote:
> >go Rasmus go! :-)
> >
> >Some more examples and we seriously can extend zend.com/apidoc .
> >
> >Such examples are of great value to anyone who is new to writing php
> >extension.
> >
> >- Markus
> >
> >On Mon, Aug 13, 2001 at 02:14:01AM -0700, Rasmus Lerdorf wrote :
> >> Ah, ok. It's not much harder:
> >>
> >> pval *tmp_arr;
> >>
> >> array_init(return_value);
> >> MAKE_STD_ZVAL(tmp_arr);
> >> array_init(tmp_arr);
> >> add_assoc_string(tmp_arr, "string index", "foo", 1);
> >> zend_hash_index_update(Z_ARRVAL_P(return_value), 5, &tmp_arr,
> >sizeof(tmp_arr), NULL);
> >>
> >> This will create $whatever[5]['string index'] = 'foo'
> >>
> >> Or if you want a string index at the top level:
> >>
> >> zend_hash_update(Z_ARRVAL_P(return_value), "bar", strlen("bar")+1,
> >&tmp_arr, sizeof(tmp_arr), NULL);
> >>
> >> This will create $whatever['bar']['string index'] = 'foo';
> >>
> >> -Rasmus
> >>
> >> On Mon, 13 Aug 2001, Thomas Wentzel wrote:
> >>
> >> > 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]
> >
> >--
> >Markus Fischer, http://guru.josefine.at/~mfischer/
> >EMail: [EMAIL PROTECTED]
> >PGP Public Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
> >PGP Fingerprint: D3B0 DD4F E12B F911 3CE1 C2B5 D674 B445 C227 2BD0
> > -All your scripts are belong to Zend-
> >
> >--
> >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]
>
> --
> Zeev Suraski <[EMAIL PROTECTED]>
> CTO & co-founder, Zend Technologies Ltd. http://www.zend.com/
--
Markus Fischer, http://guru.josefine.at/~mfischer/
EMail: [EMAIL PROTECTED]
PGP Public Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
PGP Fingerprint: D3B0 DD4F E12B F911 3CE1 C2B5 D674 B445 C227 2BD0
-All your scripts are belong to Zend-
--
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]