what is constructor in a class, how it is work, how it is call?

Answer Posted / sei thu htun

Constructors are functions in a class that are automatically
called when you create a new instance of a class with new. A
function becomes a constructor, when it has the same name as
the class. If a class has no constructor, the constructor of
the base class is being called, if it exists.

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is node js better than php?

601


What is pdo classes?

550


Tell me how can we display information of a variable and readable by human with php?

554


Is key exist in array php?

526


How to initiate a session in php?

643






How can we determine whether a variable is set?

517


What are the different errors in php?

554


Write a program to swap two numbers using php.

530


Is false empty php?

537


Tell me how can you pass a variable by reference?

502


Explain the differences between get and post methods?

484


how to detect a mobile device using php

584


Php being an open source is there any support available to it?

536


How to reset/destroy a cookie?

566


Do you know what does mvc stand for and what does each component do?

492