PHP试图删除对象的引用

$root = new FileSystemNode("~", true);
$desktop = new FileSystemNode("Desktop", true);
$root->children[$desktop->name] = &$desktop;

...

$q = &$root->children["Desktop"];
unset($q);

I am doing this weird thing just to understand what is going on behind of this code.

Real Scenario: After creating and connecting objects(in first 3 lines), I may want to assign 'Desktop' to a variable in the code somewhere and after that I may want to delete it. But, unfortunately, it is not deleted at all. I still can access to $root->children["Desktop"].

Any suggestion?

Objects are always references as of PHP 5. The & operator has no influence in your example.


Update: (because of your question in comments):

If you need an independent copy of an object use clone:

$q = clone $root->children["Desktop"];