[PHP-DEV] returning arrays
hi there, i have an extension with a funtion that should return an array, but my array is empty ?. -- snip -- ZEND_FUNCTION(foo) { zval *tmp_array; MAKE_STD_ZVAL(tmp_array); array_init(tmp_array); array_init(return_value); // a loop to fill the array with some data for(i=0; i 10; i++) { add_index_string(tmp_array, i, some_data, 1); } } /snip - hope someone can tell me whats wrong. marco -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] returning arrays
Marco Glatz wrote: hi there, i have an extension with a funtion that should return an array, but my array is empty ?. -- snip -- ZEND_FUNCTION(foo) { zval *tmp_array; MAKE_STD_ZVAL(tmp_array); array_init(tmp_array); array_init(return_value); // a loop to fill the array with some data for(i=0; i 10; i++) { add_index_string(tmp_array, i, some_data, 1); } } is it missing some code - or did you mean to do add_index_string(return_value, i, some_data, 1); /snip - hope someone can tell me whats wrong. marco -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
AW: [PHP-DEV] returning arrays
Marco Glatz wrote: hi there, i have an extension with a funtion that should return an array, but my array is empty ?. -- snip -- ZEND_FUNCTION(foo) { zval *tmp_array; MAKE_STD_ZVAL(tmp_array); array_init(tmp_array); array_init(return_value); // a loop to fill the array with some data for(i=0; i 10; i++) { add_index_string(tmp_array, i, some_data, 1); } } is it missing some code - or did you mean to do add_index_string(return_value, i, some_data, 1); whoops ... anyway, thanx :o) marco -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php