== Quote from Eric Daspet ([EMAIL PROTECTED])'s article
> Be carreful, this does not resolve all things :
>
> $source1 = new stdClass ;
> $source2 = new stdClass ;
> $source3 = new stdClass ;
> $refLevel1 = new stdClass ;
> $refLevel2 = new stdClass ;
>
> $source1->ref = $refLevel1 ;
> $source2->ref = $refLevel1 ;
> $source3->ref = $refLevel1 ;
>
> $refLevel1->ref = $refLevel2 ;
>
>
> We have :
> refcount of 1 : $source1, $source2 and $source3
> refcount of 2 : $refLevel2 ;
> refcount of 4 : $refLevel1 ;
>
> $refLevel1 as a refcount of 4 but should be destroyed before $refLevel2
> (which has a refcount of 2).

> This is NOT the same as destroy refcounts of 1, then refcount of 2, etc.

Hum... good point for you ;-)

I was in a hurry to test your case within a function (local variables), and the 
objects were destroyed as expected.

It's a bit frustrating to know that PHP perfectly handles destruction mechanism for 
local variables, but not for global variables...

Stephane

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to