What's the difference between __construct() and init()

tom picture tom · Sep 19, 2010 · Viewed 36.5k times · Source

I was wondering what is the difference between __construct() and init() functions in a PHP application, more particularly in a Zend Framework application.

Answer

Colin Hebert picture Colin Hebert · Sep 19, 2010

init() is called by the constructor.

init() isn't defined in the specification of PHP, it's only a method available with the Zend Framework to help initialize without having to rewrite the constructor yourself.


On the same topic :