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

Can we override magic methods in php?

534


How to find a substring from a given string in php?

505


Why php was called as personal home page?

540


What is the use of strip_tags() method?

552


What is php in simple words?

519






Is age nominal or ordinal?

514


Why is php used?

562


How the values are ordered in an array?

572


Explain the syntax for ‘foreach’ loop with example.

497


How can I load data from a text file into a table?

565


How do you use bcrypt for hashing passwords in php?

534


Describe which programming language does php parallel to?

472


What is multidimensional array in php?

544


What is variable declaration?

491


Write down the benefits of php7?

632