In PHP 4 constructors were supported by creating a function
with the same name as the class
<?php
class foo {
function foo($param) {
/* ... */
}
}
?>
In PHP 5, the __construct() method will be called (if it exists)
when the object is created, and the __destruct() method when it is
destroied.
<?php
class newfoo {
function __construct($param) { /* ... */ }
function __destruct() { /* ... */ }
}
?>
Note: PHP 4 style constructs will be supported for backward compatibility.