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 explode() in php?
How to Pass JSON Data in a URL using CURL in PHP?
Do you know how to delete a file from the system?
What is the purpose of the '.frm' file extension? What do thes file contain?
Is php closing tag necessary?
What library is used for pdf in php?
How will you calculate days between two dates in PHP?
What are php parameters?
Suppose your zend engine supports the mode Then how can you configure your php zend engine to support Mode ?
Explain Constant in Class?
Tell me how can we display information of a variable and readable by human with php?
What is the importance of "action" attribute in a html form?
What is session data?
What is the difference between rest and soap?
What will the ?getdate() function returns in PHP?