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
How to close a session properly?
How to get ip address of clients machine?
Explain what are the two main string operators?
What is the difference between static and dynamic websites?
Is php harder than javascript?
How can we increase execution time of a php script?
How to open a file in php?
How to update memcached when you make changes to php?
Tell us how can we access the data sent through the url with the post method?
What is the purpose of break and continue statement?
What are php loops?
What is difference between base_url and site_url?
What is the use session in php?
Is null function in php?
How do I repair phpmyadmin?