diff --git a/language/oop5/decon.xml b/language/oop5/decon.xml index 38f680e9ab..353d242aef 100644 --- a/language/oop5/decon.xml +++ b/language/oop5/decon.xml @@ -1,10 +1,15 @@ - + Constructors and Destructors Constructor + + void__construct + mixedargs + ... + PHP 5 allows developers to declare constructor methods for classes. Classes which have a constructor method call this method on each @@ -52,14 +57,17 @@ $obj = new SubClass(); + Destructor + + void__destruct + PHP 5 introduces a destructor concept similar to that of other - object-oriented languages, such as Java: When the last reference to an - object is destroyed the object's destructor, which is a class method - named __destruct that receives no parameters, is - called before the object is freed from memory. + object-oriented languages, such as Java. The destructor method will be + called as soon as all references to a paticular object are removed or when + the object is explicitly destroyed. Destructor Example