Hi everyoneI am writing a function which can save the value of arguments, for
example:
print_r(config("a",array("sub"=>"baidu")));
print_r(config("b",array("sub"=>"google")));
I want to get the result as below:
Array
(
[a] => Array
(
[sub] => baidu
)
)
Array
(
[a] => Array
(
[sub] => baidu
)
[b] => Array
(
[sub] => google
)
)
I use add_assoc_string() when the argument is string,and it works fine,but when
the argument is a array,and i use
add_assoc_zval(),the result is not what i want.
here is my code:
if(Z_TYPE_P(value) == IS_STRING){
add_assoc_string(config, key, Z_STRVAL_P(value), 1);
RETURN_ZVAL(config, 1, 0);
return;
}else if(Z_TYPE_P(value) == IS_ARRAY){
add_assoc_zval(config, key, value);
RETURN_ZVAL(config, 1, 0);
return;
}
what could the problem be?