Re: Reassigning variable to new object destroys old one?
- From: Tyno Gendo <you@localhost>
- Date: Mon, 30 Apr 2007 17:43:23 +0100
ZeldorBlat wrote:
The object is automatically destroyed when nothing is referencing it.
When you assign the second instance to $x, there is nothing left
referencing the first instance.
There was another thread on this subject recently:
<http://groups.google.com/group/comp.lang.php/browse_frm/thread/
7046181c4c507263/3e766edeeebbd5f5#3e766edeeebbd5f5>
At the risk of starting the $a++ thread again ... hehe
I believe that will be why $a = $a++; doesn't work.
The PHP manual should say $a++ "Returns value of $a" not "Returns $a..."
which to me infers it returns itself as a reference and the ++ should work.
But, returns value of a, hence $a overwrites itself, and the ++ tries to take effect on the original which now has no references so doesn't exist.
Umm... Monday afternoon.. I'm bored and perplexed at the same time.
I don't think that helped you, sorry. I'll get my coat.
.
- References:
- Reassigning variable to new object destroys old one?
- From: woger151
- Re: Reassigning variable to new object destroys old one?
- From: ZeldorBlat
- Reassigning variable to new object destroys old one?
- Prev by Date: Re: Reassigning variable to new object destroys old one?
- Next by Date: Re: @mysql_query ?
- Previous by thread: Re: Reassigning variable to new object destroys old one?
- Next by thread: @mysql_query ?
- Index(es):
Relevant Pages
|