what is constructor in a class, how it is work, how it is call?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / kapil dhiman
Constructor is a special function which is automaticaly called when object of the class is created.In php4 costructor having the same name of the class while in php5 costructor function declare like __construct(){ }.
<?
class MakeConstruct{
public function __construct(){
echo "php5 construct";
}
public function MakeConstruct(){
echo "php4 construct";
}
}
$obj= new MakeConstruct();
?>
| Is This Answer Correct ? | 2 Yes | 0 No |
What types of MYSQL function available for affecting columns
What is the function file_get_contents() useful for?
How to avoid the undefined index error?
What are the environmental variables?
What is a controller php?
my english is not too good then what we apply for a php programer post
Maine 12th ke bad 2 years ka web designing ka course kiya hai. Php me achcha hu. Ek fresher ko is field me kitna mil sakta hai ?
What is difference between rest and http?
Does php support multiple inheritance?
How can I display text with a php script?
What is the Pipe Symbol represented?
Explain what is the difference between session and cookie?