Re: Re: &$this?
| From: | Ming-Chieh Lee | Date: | Wed, 26 Sep 2001 19:22:41 +0000 |
| Subject: | Re: Re: &$this? | ||
| References: | 1 2 3 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-9554@lists.php.net to get a copy of this message | ||
Hello all, Thanks for the input. Chen Wei, thanks for clarifying my
question. So why do we need to make a reference out of a variable that
already contains a reference? I
Thanks for any input!
"Chen Wei" <chenwei@earth9.com> wrote in message
news:120453264830.20010926180143@earth9.com...
> Hi _lallous,
>
> yes, but I think he knew this already. the question is that since $this
> itself is a reference to the object, why inside the class still need to
> assign the address of $this to $globalref[]?
>
>
> --
> regards,
> chen wei (http://www.cw213.net)
> ===================================
> Solutions Developer of Earth9.com
> ===================================
>
>
> Wednesday, September 26, 2001, 6:45:15 PM, you wrote:
>
> _> &$varname menas to take the address of the variable,
>
> _> example:
>
> _> $a = "Hello world!";
> _> $b = &$a;
> _> $b = "Hi! this is var B";
> _> echo $a;
>
> _> // output will be: Hi! this is var B
>
> _> "Ming-Chieh Lee" <ming@thesmartport.com> wrote in message
> _> news:20010925194957.34536.qmail@pb1.pair.com...
> >> does anyone know what does &$this mean? I saw this on the php.net
> _> tuturial
> >> for references inside a constructor.
> >> I thought that $this is already a reference?
> >> The way it was used :
> >> class Foo
> >> {
> >> function Foo($name)
> >> {
> >> // create a reference inside the global array $globalref
> >> global $globalref;
> >> $globalref[] = &$this;
> >> // set name to passed value
> >> $this->setName($name);
> >> // and put it out
> >> $this->echoName();
> >> }
> >> thanks for any input!
> >>
> >>
> >>
>