I am newish to the OOP style of PHP5, I have noticed __construct
and __deconstruct
within example classes and production classes.
I have read over the manual of this:
http://php.net/manual/en/language.oop5.decon.php
and looked over a range of questions/answers on StackOverflow. I'm still having trouble to understand what is the actual meaning of its exisitance?
class foo {
function __construct()
{
// do something
}
public function Example ()
{
echo "Example Functions";
}
function __destruct()
{
// do something
}
}
The same class can function the same with no hits as:
class foo {
public function Example ()
{
echo "Example Functions";
}
}
But the manual states with the above example, that my first function will take over the role as the __construct
Why is this a priority within PHP5 OOP Classes?