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 get method in java?
How to block direct directory access in PHP?
Where do I run php code?
How do you trim spaces in excel?
What is the use of limit in mysql?
What is mvc php?
What is a http session?
How does session work in php?
How to convert a string to uppercase in php?
What does $_server mean?
What is the use of $_request variable?
What is strcmp () in php?
What is the use of rand() in php?
What does addslashes do in php?
How to increase the execution time of a PHP script?