View Single Post
Old 05-16-2009, 01:19 PM   #2 (permalink)
allworknoplay
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by captainmerton View Post
Quick question about best practice:

When i create an object i use the standard contructor method. Is there an equivalent for destroying an object? If so what is it? If not, what is best practice - should i be destroying objects when i have finished with them?

Cheers,

Capt Merton
You can use the __destruct() construct. The only difference with having one in your class and not having one is that if you don't have one, PHP will destroy your object at the end of the executed script.

As long as there are no more references to the object it will get destroyed.
allworknoplay is offline  
Reply With Quote