# transversing associative arrays from C

- Thread: https://externals.io/message/54952
- Original archive: https://news-web.php.net/php.internals/54952
- Started by Aaron Gray on 2011-08-25T21:39:24+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #54952 — Aaron Gray — 2011-08-25T21:39:24+00:00

URL: https://externals.io/message/54952#54952

Hi,

I am working on a C extension module for PHP and am wondering about an API 
issue.

I can see how to add to an associative array :-

    zval *aa;
    MAKE_STD_ZVAL(aa);
    array_init(aa);

    add_assoc_string(aa, "test", "test value", 1);

but how do I transverse an associative array of values in a for loop simular 
to using "foreach" in PHP ?

Hope this is not too OT for this list, but I could not find a better place 
to ask the question.

I have looked through the API SVN sources and this seems like a possible 
blind spot.

Many thanks in advance,

Aaron
