Re: array functions
| From: | Wez Furlong | Date: | Sat, 06 Nov 2004 04:06:31 +0000 |
| Subject: | Re: array functions | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-1589@lists.php.net to get a copy of this message | ||
You want something along the lines of:
zval *font_list;
MAKE_STD_ZVAL(font_list);
array_init(font_list);
for (i = 0; flist[i]; i++) {
add_next_index_string(font_list, flist[i], 1);
}
if you're just returning the items from a PHP_FUNCTION, you'd probably
want something like this instead:
array_init(return_value);
for (i = 0; flist[i]; i++) {
add_next_index_string(return_value, flist[i], 1);
}
On Sat, 6 Nov 2004 02:58:58 +0000, gareth@fission.org.uk
<gareth@fission.org.uk> wrote:
> Hi,
>
> Having a bit of a problem working out how to create arrays.
>
> Basically, I've got a library function which returns a char **flist
>
> now, what I want to do is loop through this, and for each entry insert an entry into a php
> accessable array.
>
> From what I can see from the docs - I need to do:
>
> int font_list = 1;
> array_init(font_list);
> /*for loop here*/ {
> add_next_index_stringl(font_list,flist[i],strlen of flist[i],0);
> }
>
> Does that look right, or have I totally misunderstood the docs ?
>
> --
> PECL development discussion Mailing List (http://pecl.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>