Re: [PHP4BETA] access to $this->myvar from C
| From: | Andrei Zmievski | Date: | Tue, 01 Feb 2000 14:10:06 +0000 |
| Subject: | Re: [PHP4BETA] access to $this->myvar from C | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-9620@lists.php.net to get a copy of this message | ||
On Mon, 31 Jan 2000, php@home.uh.nu wrote:
> Howdy folks,
> I'm writing a C wrapper function to php for my needs, and was wondering
> how I would go about getting access to a class variable.
>
> Here is what I have (for example)
>
> class my_class
> {
>
> var $mytest;
>
> function my_test()
> {
> myc_wrapper($foo);
>
> echo $this->mytest;
> }
> }
>
>
> from myc_wrapper, how can I set the value of this->mytest.
You can pass $this to myc_wrapper (by reference, of course), and use
that to set the variable. Example:
function myc_wrapper(&$obj, $foo)
{
...
$obj->mytest = "bar";
}
Then you call it from the object like this:
myc_wrapper($this, $foo);
-Andrei
* Software never has bugs. It just develops random features. *