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);

}

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to