Purpose of PHP constructors

Posted by Bharanikumar on Stack Overflow See other posts from Stack Overflow or by Bharanikumar
Published on 2010-06-13T15:42:28Z Indexed on 2010/06/13 16:02 UTC
Read the original article Hit count: 110

Filed under:
|
|

Hi,

I am working with classes and object class structure, but not at a complex level – just classes and functions, then, in one place, instantiation.

As to __construct and __destruct, please tell me very simply: what is the purpose of constructors and destructors?

I know the school level theoretical explanation, but i am expecting something like in real world, as in which situations we have to use them.

Provide also an example, please.

Regards

© Stack Overflow or respective owner

Related posts about php

Related posts about class