On Mon, Mar 25, 2002 at 09:59:12AM -0500, arti wrote : > I do not understand why I am getting the error "Undefined variable this" in > this snippet of code (note for brevity I cut out a lot of code): > > <?php > class standardquestion > { > var $private; > > function standardquestion($xmlfilename) > { > > $this->private=FALSE; > > <skip some stuff here> > > } > > function startElementHandler($parser, $name, $attribs) > { > if ($name=="private") > $this->private = TRUE; > > if ($this->private==FALSE) // <<<<---- Undefined variable > this > return; > }
You're missing the relevant which calls this method. > As you can see, I initialize the variable as the first line in the > constructor. But, why is "this" suddenly undefined? I presume I'm doing > something stupid, but I am new to PHP and am missing something here. For the future, such things should be targeted at [EMAIL PROTECTED] ; NOT php-dev@ -- Please always Cc to me when replying to me on the lists. GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php