Re: do classes work properly?

From: Date: Wed, 28 Jun 2000 15:46:27 +0000
Subject: Re: do classes work properly?
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-733@lists.php.net to get a copy of this message
Andrew, Yes, classes work. You are referencing the variables incorrectly. Change all $this->$ with $this-> (no $ for the second part). The variables are named $this->width and $this->height. At 6/27/2000 08:09 AM, Andrew Hurley wrote: >Hello all. > >This is my code: > > class Test { > > var $width; > var $height; > > function Test () { > > $this->$width = "really longgggggg"; > $this->$height = "really highhhhhh"; > > } > > function serve () { > > print "This is the width: " . $this->$width . "<br>"; > print "This is the height: " . $this->$height . "<br>"; > > } > > } > >The output I get is: > > This is the width: really highhhhhh > This is the height: really highhhhhh > >This happens with other classess too. > >Any ideas? > >Thanks. >Andrew. -- /* SteeleSoft Consulting John Steele - Systems Analyst/Programmer * We also walk dogs... jsteele@writeme.com * http://www.gamecomputer.com/ssc/ */

« previous php.windows (#733) next »