RE: do classes work properly?

From: Date: Wed, 28 Jun 2000 00:55:54 +0000
Subject: RE: do classes work properly?
Groups: php.windows 
Request: Send a blank email to php-windows+get-712@lists.php.net to get a copy of this message
---------------------------------------------------------------------------- ----------------- Disclaimer: The information contained in this email is intended only for the use of the person(s) to whom it is addressed and may be confidential or contain legally privileged information. If you are not the intended recipient you are hereby notified that any perusal, use, distribution, copying or disclosure is strictly prohibited. If you have received this email in error please immediately advise us by return email at postmaster@normandy.com.au and delete the email document without making a copy. ---------------------------------------------------------------------------- ----------------- Andrew, The answer is yes.... (but i wish they had destructors ;) Your problem though has something to do with the fact that you are not referencing class properities properly. Try $this->width = "really longgggggg"; $this->height = "really highhhhhh"; and print "This is the width: " . $this->width . "<br>"; print "This is the height: " . $this->height . "<br>"; notice the lack of the second $ sign? I think that PHP thinks $this->$foo = $this->$height = $this->$width which is why you got your results. mn -----Original Message----- From: Andrew Hurley [mailto:ahurley@gcom.nnnneeettttt.au] Sent: Tuesday, June 27, 2000 3:09 PM To: php-windows@lists.php.net Subject: do classes work properly? 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.

« previous php.windows (#712) next »