unable to unset reference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

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 ???

if you don't think so can you think of something different to destroy
both of them like I don't know, destroy($obejctsreference)

Regards.

Reproduce code:
---------------
<?

$x = new stdClass();
$x->a = 'ayayaye';

$b[0] =& $x;

unset($b[0]);

var_dump($x);

?>

Expected result:
----------------
NULL

Actual result:
--------------
object(stdClass)#1 (1) {
  ["a"]=>
  string(7) "ayayaye"
} 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux