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 interface in php? how it is use?

Answer Posted / nur nahid hasan

Interface: Since we all knows that PHP does not support the
multiple inheritance. But don't worry we have an excellent
idea to do the multiple inheritance in php is Interface.
Interface is just like a class using interface keyword and
contains only function declarations(function with no body).
function is defined in the classes where you call it.

Ex:-

interface FirstInterfName{
function Add();
function Sub(10,5);
}

interface SecondInterfName{
function glbfunc1();
function glbfunc2();
}


class ClassName implements FirstInterfName,SecondInterfName
{
fuction Add()
{
$a = 5;
$a = $a + 1;
echo $a;
}

fuction Sub($a,$b)
{
$c = $a -$b;

echo $c;
}

function glbfunc1()
{
Implements here method...............
}

function glbfunc2()
{
Implements here method...............
}

}

Is This Answer Correct ?    19 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why use static methods php?

1051


What is htmlentities function in php?

947


Are static variables final?

997


What does csrf token mismatch mean?

1142


How to access a global variable inside a function?

1001


Explain what is smarty?

1049


What is php mean?

1021


Is null check in php?

986


How does cookies work in php?

968


Explain what is the difference between mysql_fetch_array() and mysql_fetch_assoc()?

897


How does csrf token work?

1012


Does php support multiple inheritance?

967


How do you clear environment variables?

930


Explain me how failures in execution are handled with include() and require() functions?

1017


What is the use of inner join in mysql?

969