Class foo {

   Var $bar = 'bar';

   function baz() {
      echo '$this->bar once used to be ' . $this->bar;
      unset($this->bar);
      echo "<br> ...and not it's not : {$this->bar}";
   }
}


$foo = new foo();
unset($foo);

// kill the instance outside the class



Cheers,

Maxim Maletsky
Founder, Chief Developer

PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com




> -----Original Message-----
> From: Ian [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 11, 2002 2:27 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: unsetting an instance from within its class
> 
> $this
> 
> "Erik Price" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Is there a way to unset or destroy an object instance from a method
> > within its class?  I'm trying to write a method that destroys its
> > instance but I'm not sure how to refer to the object itself from
within
> > the class.
> >
> >
> > Erik
> >
> >
> >
> >
> >
> > ----
> >
> > Erik Price
> > Web Developer Temp
> > Media Lab, H.H. Brown
> > [EMAIL PROTECTED]
> >
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to