05-16-2009, 01:19 PM
|
#2 (permalink)
|
|
The Gregarious
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
|
Quote:
Originally Posted by captainmerton
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.
|
|
|
|