Hi, I have been looking around for an example of accessing a PHP Array from a PHP C-language extension.
The best documentation I could find:
http://www.scit.wlv.ac.uk/appdocs/php/zend.arguments.access.html
Describes how to access variables up to (but not including) Arrays and Objects. For those two, all it says is "Accessing Arrays and Objects is a bit more complicated and is discussed later." But I can't find the "later."
If I have:
zval *theArray;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &theArray) == FAILURE)
{
return;
}
How can I, in C, iterate over the members of the array and get info about any associations?
For instance, if I created the PHP array:
$php_array = array();
$php_array['1'] = 'a';
$php_array['2'] = 'b';
$php_sub_array = array();
$php_sub_array['x'] = 'i';
$php_sub_array['y'] = 'j';
$php_array['3'] = $php_sub_array;
and passed $php_array to my function, can you show me (or give me an idea), how to walk the root array getting each element's 'key' and the 'value'?
If you can show me that, I can extrapolate for reading sub-arrays -- unless there are any gotcha's I should know about.
Thanks.