what is constructor in a class, how it is work, how it is call?
Answer Posted / 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 |
Post New Answer View All Answers
What is the advantage of runtime polymorphism?
What is an anti csrf token?
What is Apache's configuration file typically called?
What are the method available in form submitting?
What is difference between base_url and site_url?
Tell me how comparison of objects is done in php5?
What are the different types of statements that are present in php?
How to call php function in jquery?
What is a namespace in php?
What are the rules to determine the “truth” of any value which is not already of the boolean type?
What is a php trait?
What is $_ files in php?
What is the purpose of php?
What is php limit?
Which is the best web server?