JObject/JObject

From Joomla! Documentation

Jump to: navigation, search

A hack to support __construct() on PHP 4.

In PHP 5 a method becomes a constructor when it has name "__construct". In PHP 4 constructors have the same name as the class. But it will be convenient to name constructors in the same way independently of PHP version.

This method is a hack to support __construct() on PHP 4. It works because it has the same name as the class. Also it will be invoked when a child class has no constructor. When invoked it calls method $this->__construct() and pass its arguments to it. So you can use JObject as a base class for your classes and name constructors as "__construct".

See also

Personal tools