tell me about... constructors
- a) A constructor is a method (a method is a function.)
- b) A constructor is called by php automatically when new objects are created.
- c) This means that you can call the function by putting data in the parameters directly after the class (see diagram 2)
- d) __construct is used to denote a php constructor (see diagram 1)

diagram 2
- e) Only create a constructor() method when you need to make specific initial settings inside the object.
- f) Php creates a default constructor if you don't specify one. This constructor will work fine unless you want to change the default settings in new objects.


0 Comments:
Post a Comment
<< Home