Re: do classes work properly? - with exe code this time
| From: | Andrew Hurley | Date: | Tue, 27 Jun 2000 14:15:53 +0000 |
| Subject: | Re: do classes work properly? - with exe code this time | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-693@lists.php.net to get a copy of this message | ||
Thankyou all who wrote back. Much appreciated. I couldn't see the wood for
the trees!
""Eduardo Jordan G."" <ejordan@accessinter.net> wrote in message
news:01BFE014.A892E470@WEBMASTER...
Hi,
When refering a data member from inside the class use
$this->var NOT $this->$var.
Notice u need only one $
Eduardo Jordán G.
ejordan@accessinter.net
-----Original Message-----
From: Andrew Hurley [SMTP:ahurley@gcom.nnnneeettttt.au]
Sent: Tuesday, June 27, 2000 8:37 AM
To: php-windows@lists.php.net
Subject: [PHP-WIN] do classes work properly? - with exe code this time
Hello all.
This is my code in file "table.php"
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>";
}
}
Used in another php file as so:
<?php
require("table.php");
$raw = new Test;
$raw->serve();
?>
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?
Note: could it be the use of var? In the manual there is only examples of
using var with one variable, unfortunately.
I'm used to C++ where an object declares vars and funcs.
Thanks.
Andrew.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
For additional commands, e-mail: php-windows-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
For additional commands, e-mail: php-windows-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net