Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


what is constructor in a class, how it is work, how it is call?

Answers were Sorted based on User's Feedback



what is constructor in a class, how it is work, how it is call?..

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

what is constructor in a class, how it is work, how it is call?..

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

Post New Answer

More PHP Interview Questions

What is the difference between echo print and print_r in php?

0 Answers  


What is the difference between for and foreach in php?

0 Answers  


How many ways we can pass the variable through the navigation between the pages?

7 Answers  


What is $_ request in php?

0 Answers  


I went to an php interview yesterday.I got selected there.But,They asked me to sign bond by submitting my certificates for 2 years.Is it good or bad

7 Answers  


How cookies are trported from browsers to servers?

0 Answers  


How to use the COM components in PHP?

2 Answers   HCL,


What is the use of stripslashes in php?

0 Answers  


What is the best way to test the strpos() return value in php?

0 Answers  


What is baseurl?

0 Answers  


Explain setcookie() function in php?

0 Answers  


How to submit form without a submit button.

0 Answers  


Categories