masklinn í dag viðrar vel til loftárása | FlorentG a écrit :
Et à cause du GC de type refcount, ça ne sert même pas en cas de références circulaires
Code :
class A { public $b; } class B { public $a; } $a = new A(); $b = new B(); $a->b =& $b; $b->a =& $a; xdebug_debug_zval('a', 'b'); xdebug_debug_zval('a', 'b');
|
Donne
Code :
- a:
- (refcount=2, is_ref=1),
- object(A)[1]
- public 'b' => (refcount=2, is_ref=1),
- object(B)[2]
- public 'a' => (refcount=2, is_ref=1),
- &object(A)[1]
- b:
- (refcount=2, is_ref=1),
- object(B)[2]
- public 'a' => (refcount=2, is_ref=1),
- object(A)[1]
- public 'b' => (refcount=2, is_ref=1),
- &object(B)[2]
- b:
- (refcount=2, is_ref=1),
- object(B)[2]
- public 'a' => (refcount=1, is_ref=0),
- object(A)[1]
- public 'b' => (refcount=2, is_ref=1),
- &object(B)[2]
|
Donc unset ne fait déréférencer la variable que dans le scope local ![[:moule_bite] [:moule_bite]](https://forum-images.hardware.fr/images/perso/moule_bite.gif)
|
heuuu...
encore heureux, unset ça dégage la référence qu'on lui demande de dégager, pas une autre au pif comme ça tac tac, même pour PHP ça atteindrait des sommets d'imbécilité ![[:pingouino] [:pingouino]](https://forum-images.hardware.fr/images/perso/pingouino.gif) ---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
|