Re: Resource array of arrays (variable at runTime)
| From: | Justin Hannus | Date: | Wed, 17 Dec 2003 15:15:15 +0000 |
| Subject: | Re: Resource array of arrays (variable at runTime) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-6491@lists.php.net to get a copy of this message | ||
Yes,
Check out zend_hash_update() and zend_hash_index_update() to add elements to
your array. For multidimensional arrays, each element (that is an array)
mould be a *zval that was previously array_init()'d and filled with zvals
pointers.
Not sure but I think the PECL list might be a better place for the question.
-Justin Hannus
"VIVI arno" <arnokarine@yahoo.fr> wrote in message
news:20031217100850.50458.qmail@web86104.mail.ukl.yahoo.com...
> Hello,
>
> I try to build an extension for my pleasure.
> I would like to make a function which return me an array of variable
arrays. For example, I would like that the function "myfunction( $line,
$col, $DefaultValue)", return me one array of line arrays with col colums.
> I mean:
> $array = { [0] => {[0]=>1,[1]=>1,...[col]=>1}
> [1] => {[0]=>1,[1]=>1,...[col]=>1}
> ................................................
> [line] => {[0]=>1,[1]=>1,...[col]=>1}
> }
>
> Actually, I have this :
>
> //**********************************************************
> zval *childAr , *childAr2 , *childAr3, *childAr4;
> MAKE_STD_ZVAL(childAr);
> MAKE_STD_ZVAL(childAr2);
> MAKE_STD_ZVAL(childAr3);
> MAKE_STD_ZVAL(childAr4);
>
> if (array_init (childA) == FAILURE){
> php_error (E_ERROR, "Cannot initialize childAr from return_multi");
> RETURN_NULL();
> }
> if (array_init (childAr2) == FAILURE){
> php_error (E_ERROR, "Cannot initialize childAr2 from return_multi");
> RETURN_NULL();
> }
> if (array_init (childAr3) == FAILURE){
> php_error (E_ERROR, "Cannot initialize childAr3 from return_multi");
> RETURN_NULL();
> }
> if (array_init (childAr4) == FAILURE){
> php_error (E_ERROR, "Cannot initialize childAr4 from return_multi");
> RETURN_NULL();
> }
> //**********************************************************
>
> So, with this, I can only return an array of four arrays maximum.
> I mean :
> $array = { [0] => {[0]=>1,[1]=>1,...[col]=>1}
> [1] => {[0]=>1,[1]=>1,...[col]=>1}
> ................................................
> [3] => {[0]=>1,[1]=>1,...[col]=>1}
> }
>
>
>
> Is is possible to return an array of variable array ?
>
> Thank you to help me,
> Sincerely,
> Arnaud.
>
>
>
>
>
>
> ---------------------------------
> Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
> Testez le nouveau Yahoo! Mail