Re: unable to unset reference
| From: | Sylvain R. | Date: | Wed, 20 Feb 2008 09:45:34 +0000 |
| Subject: | Re: unable to unset reference | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-269704@lists.php.net to get a copy of this message | ||
"Chris" <dmagick@gmail.com> a écrit dans le message de news:
47BB6C80.6020704@gmail.com...
> Sylvain Rabot wrote:
>> Hello,
>>
>> First of all I would like to know if one day we will be able to unset
>> $this into a class in order to destroy the object. It could really be
>> useful to prevent big memory usage.
>
> I doubt the php-dev's will ever allow something like that, seems rather
> dangerous to me.
Why ? It would be nice to stop thinking PHP developpers are idiots who don't
know how to code.
I don't mean unset($this) is the best wy to allow an object to destroy
itself. I just say we miss something to auto destroy objects.
We could also think about a magic method like __destroy().
>> As it can't be done I tried to unset an object by unsetting a reference
>> of this object but it has no effect on the object but only on the
>> reference.
>>
>> Should unset destroy the reference itself and the object ???
>
> No, it's not meant to (and I doubt it will change). Why do you want it to
> do that?
>
> What is the original problem you're trying to solve?
>
I put SQL resources into an objects and I would like to destroy objects when
calling method free() but obviously I can't.
> --
> Postgresql & php tutorials
> http://www.designmagick.com/