arrays - PHP Trying to Delete Reference of Objects -


$root = new filesystemnode("~", true); $desktop = new filesystemnode("desktop", true); $root->children[$desktop->name] = &$desktop;  ...  $q = &$root->children["desktop"]; unset($q); 

i doing weird thing understand going on behind of code.

real scenario: after creating , connecting objects(in first 3 lines), may want assign 'desktop' variable in code somewhere , after may want delete it. but, unfortunately, not deleted @ all. still can access $root->children["desktop"].

any suggestion?

objects references of php 5. & operator has no influence in example.


update: (because of question in comments):

if need independent copy of object use clone:

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

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -