Home >Backend Development >PHP Tutorial >关于php扩展编程如何返回数组的问题_PHP

关于php扩展编程如何返回数组的问题_PHP

WBOY
WBOYOriginal
2016-06-01 12:30:35976browse

  在zend.com找到了答案,提供了一组例子,这里下载:http://www.zend.com/apidoc/examples.tar.gz

  这样返回一个数组

PHP_FUNCTION(array_experiments)
{
zval *new_element;

MAKE_STD_ZVAL(new_element);

array_init(return_value);

ZVAL_LONG(new_element, 10);
zend_hash_index_update(HASH_OF(return_value), 3, (void *)&new_element, sizeof(zval *), NULL);
add_next_index_long(return_value, 20);
}

  具体函数参见php手册 zend api部分 不过这部分的内容一直都没有翻译成中文的...看得时候好吃力,用金山词霸也看不懂,英文太烂了,期待那天那个高人没事儿给翻译了...呵呵

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn