dbworker1
asked on
Best way to destroy an object instance in php5
in php 5, what is the best way to destroy an object instance?
For example:
$myObj = new clsMyClass();
... use the object
unset($myObj) ; // is this the best way? Is $myObj = NULL; better?
Do destructors defined in the class always run in either method above?
Thanks in advance
For example:
$myObj = new clsMyClass();
... use the object
unset($myObj) ; // is this the best way? Is $myObj = NULL; better?
Do destructors defined in the class always run in either method above?
Thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
unset is the proper way to destroy a variable, its faster than say setting $myArray = array(); Your also freeing up more memory by destroying the variable completely. :-) (even if it is only a little)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://ca.php.net/oop