I had the same problem. This is, how I managed to do this:

extern "C" int fun1(pval** array) { //this is in c++

//here you generate subarrays - alements are added to the parameter array
//this generates an array of strings
  ...
  int count=xxxx;
  for (int i=0;i<count;i++) {
    char* str=estrdup("Array element");
    zval* arr_el;
    MAKE_STD_ZVAL(arr_el);
    ZVAL_STRING(arr_el,str,0);
    zend_hash_next_index_insert 
     ((*array)->value.ht,&arr_el,sizeof(zval**),NULL);
  }
  return count;
}




/* {{{ proto array fun2()  //this is in standard c
    */
PHP_FUNCTION(konf)
{
 //here you generate array with array elements

...
        if (array_init(return_value) == FAILURE) {
                RETURN_FALSE;
        }   
        
        for (...)  {
                zval* arr_element;
                MAKE_STD_ZVAL(arr_element);
                if (array_init(arr_element) == FAILURE) {
                        RETURN_FALSE;
                }

                zend_hash_next_index_insert(
                        return_value->value.ht,
                        (void*)&arr_element,sizeof(zval*),
                        NULL);
                fun1(&arr_element);  <----- now add elements
        }       
}
/* }}} */


It was something like that .... It generates two-dimensional array.
Ouuuff... It took me much of time to "develope" this...

And no guarantees ...


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