help request: php array

From: Date: Tue, 07 Oct 2003 12:39:29 +0000
Subject: help request: php array
Groups: php.internals 
Request: Send a blank email to internals+get-4719@lists.php.net to get a copy of this message
Hi internals. After looking at "Zend/zend_hash.h" e.t.c and haven't realizing how should i do that,i'm asking for your help. It should be really simple for you .... Have the following function: it should recursively convert data from rep_XXX to php data It does that for string and numbers for now. It's time to ad an array and hash. The question is near "???". (and another one - how this would look like for adding hash elements (excluding the rep_XXX stuff of course)) int rep_data_converter(repv in,zval *return_value) { if(rep_STRINGP(in)) {
       //printf("REP Will return string\n");
       RETVAL_STRING (rep_STR(in),1);
       return 1;
} if(rep_INTP(in)) {
       RETURN_LONG (rep_INT(in));
       return 1;
} if(rep_LONG_INTP(in)) {
       RETURN_LONG (rep_LONG_INT(in));
       return 1;
} // hadle array if(rep_CONSP(in)) {
       zval php_array;
       //zend_hash_init(&php_array,100,
       repv i,t;
       for(i=in;i!=Qnil;i=rep_CDR(i)) {
           printf("REP FWD to next element\n");
           rep_data_converter(rep_CAR(i),&t);
           /* ??? add t to array php_array */
       }
}
                                                                                               
RETVAL_STRING("REP: Unsupported type yet\n",1); return 0; } Thanks in advance. -- NetCat -------------------------------------------------- FREE 10MB Email + Antivirus + POP3 + more... Get it at http://www.doal.co.il:81/free/?c=antivirus

« previous php.internals (#4719) next »