Re: Reading PHP Object properties from C?

From: Date: Wed, 02 Aug 2000 06:59:02 +0000
Subject: Re: Reading PHP Object properties from C?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-27388@lists.php.net to get a copy of this message
If I'm not mistaken, an object is represented internally with the same format as an associative array, so reading the properties of it should be simply a matter of looking up the appropriate key/property in the hash table and then using the value as returned. So, if your variable that you pull out of the current context is stored in "value", you would access the keys as such: ------------------------- zval **value; HashTable *ht; zval *property1, *property2; /* initialize value here */ convert_to_object_ex(value); ht = HASH_OF(*value); if (zend_hash_find(ht, "property1", strlen("property1") + 1, (void **) &property1) == FAILURE) { /* Your error handler goes here */ return; } if (zend_hash_find(ht, "property2", strlen("property2") + 1, (void **) &property2) == FAILURE) { /* Another error handler goes here */ return; } /* convert property1 and property2 to the types you want to work with and * use them, for the most part, as you would any other variable. */ ------------------------- Chris On Tue, 1 Aug 2000, Rich Bryant wrote: > In the online documentation I see how to set object properties with functions > such as 'add_property_string'. What I do not see, however, is how my C > language extensions can read the properties of PHP objects(?) Any help would be > most appreciated. > > -Rich > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.dev (#27388) next »