Extension DLL Objects

From: Date: Mon, 14 Feb 2005 23:40:29 +0000
Subject: Extension DLL Objects
Groups: php.internals 
Request: Send a blank email to internals+get-14941@lists.php.net to get a copy of this message
I want to have a function that returns an object that essentially looks like the following: $user->name; // string that holds name of user $user->from; // string that holds where user is from $user->update(); // method that updates changed user data to db (**unsure how to code this) In my php script, I have defined a function "getuser" I call that returns this object. Here is a sample from my script: <?php $user = getuser(); echo "Your username is ".$user->name." from ".$user->from; $user->from = "Nowhereville, USA"; $user->update(); // updates user record and saves to db ?> Is there any specific or standard way I should be creating this object? Right now my code looks like this: ZEND_FUNCTION(getuser) { TUser u; if(GetLoggedInUser(&u)) { if(object_init(return_value)==SUCCESS) { add_property_string(return_value,"name",u.Info.Name,1); add_property_string(return_value,"from",u.From,1); // need to add a reference to the update function here ?? // unclear how to do this. return; } } RETURN_NULL(); } And how do I go about adding that "update()" function to my object to handle a function call to commit the object changes to the database? Thanks Chris

« previous php.internals (#14941) next »