初めて PHP 拡張機能を作成しようとしています。連想配列を返す関数が必要です。したがって、テスト上の理由から、小さな関数を作成しました。
PHP_FUNCTION(testing_array) {
char *firstVal = NULL;
char *secondVal= NULL;
int argc = ZEND_NUM_ARGS();
int firstVal_len;
int secondVal_len;
if (zend_parse_parameters(argc TSRMLS_CC, "ss", &firstVal, &firstVal_len, &secondVal, &secondVal_len) == FAILURE)
return;
array_init(return_array);
}
しかし、コンパイルしようとするたびに、コンパイラは次のように伝えます。
/root/php/php-src/ext/hello_world/hello_world.c:87: error: return_array undeclared (first use in this function)
/root/php/php-src/ext/hello_world/hello_world.c:87: error: (Each undeclared identifier is reported only once
/root/php/php-src/ext/hello_world/hello_world.c:87: error: for each function it appears in.)
私が間違っていることは何ですか?私が見たすべての例で、配列変数は宣言されていません。