what is interface in php? how it is use?
Answer Posted / jadhav yeshwanth
An Interface is like a template similar to abstract class
with a difference where it uses only abstract methods.
In simple words, an interface is like a class using
interface keyword and contains only function
declarations(function with no body).
An Interface should be implemented in the class and all the
methods or functions should be overwridden in this class.
for eg:
interface InterfaceName{
function fun1();
function fun2(a,b);
}
class ClassName implements InterfaceName{
fuction fun1(){
function implementation.......
}
fuction fun2(a,b){
function implementation.......
}
}
| Is This Answer Correct ? | 125 Yes | 19 No |
Post New Answer View All Answers
What is the function mysql_pconnect() useful for?
How do I start a php session?
Tell me how to create a session? How to set a value in session? How to remove data from a session?
What is the super method?
What’s the special meaning of __sleep and __wakeup?
What is the difference between php and core php?
What is self in php?
What is the use of ajax in php?
Which MySQL function would you use to select a database?
What type of errors can be occurred in php?
Explain the installation of PHP on UNIX systems?
What are the encryption functions in php?
Define about declare construct?
> symbol is used to redirect the output of a command. State Whether True or False?
What are the three classes of errors that can occur in php?