zend api object in object

From: Date: Fri, 13 Jul 2001 12:10:11 +0000
Subject: zend api object in object
Groups: php.dev 
Request: Send a blank email to php-dev+get-59952@lists.php.net to get a copy of this message
Hi, Sterling asked me to post this *here* instead of query on IRC ;-)) I'd like to write a function which gets on argument (an object). The function itself creates another object and adds the object it got to this object and returns this object. So in PHP one is able to create an object $myObject and give this to the function $newObject = moh_create_object($myObject) $newObject itself includes now $myObject. $newObject->myObject->something_from_myObject Is that possible and if yes how? I tried to add the object got as argument to the hash table of the new argument, but didn't get the result I hoped. Maybe I did something wrong, here is the code. Thx n advance -Richard (moh@IRCnet) here the code: PHP_FUNCTION(moh_create_object) { zval **arg; char *sub_object = "test"; if (zend_get_parameters_ex(1,&arg) == FAILURE) { RETURN_FALSE; } if (object_init(return_value) == FAILURE) { php_error(E_WARNING, "Cannot init the object"); RETURN_FALSE; } add_property_string(return_value, "something", "moh",1); zend_hash_add(HASH_OF(return_value), sub_object, sizeof(sub_object), arg, sizeof(zval *), NULL); }

« previous php.dev (#59952) next »