Re: do classes work properly?
| From: | Giuseppe D'Ambrosio | Date: | Tue, 27 Jun 2000 12:46:59 +0000 |
| Subject: | Re: do classes work properly? | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-688@lists.php.net to get a copy of this message | ||
------- Start of forwarded message -------
Subject: Re: [PHP-WINDOWS] do classes work properly?
To: ahurley@gcom.nnnneeettttt.au
From: Giuseppe D'Ambrosio <da_g@altavista.com>
Date: 27 Jun 2000 04:24:09 PDT
On Tue, 27 June 2000, "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?
Hello Andrew,
I think your code is a bit strange,
try this script:
<?php
class Test {
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>";
print "This is nothing : " . $this->nothing . "<br>";
}
}
$t = new Test;
$t->serve();
?>
take also a look at
"Chapter 13. Classes and Objects" from php manual
(sincerely, I'm a php-beginner and never used classes till now..)
Hope this helps
bye,
Giuse
_______________________________________________________________________
$1 million in prizes! 20 daily instant winners.
AltaVista Rewards: Click here to win!
http://shopping.altavista.com/e.sdc?e=3
_______________________________________________________________________
------- End of forwarded message -------
_______________________________________________________________________
$1 million in prizes! 20 daily instant winners.
AltaVista Rewards: Click here to win!
http://shopping.altavista.com/e.sdc?e=3
_______________________________________________________________________