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
How is a constant defined in a PHP script?
Which parts of php are case sensitive?
Steps for the payment gateway processing?
What is the differences between $a != $B and $a !== $B?
Write a statement to show the joining of multiple comparisons in php?
Explain me what is the use of 'print' in php?
How can i execute PHP File using Command Line?
How to delete file in php?
How to get the number of characters in a string?
Where are sessions stored php?
Tell me what does the scope of variables means?
What is the use of final class in php?
What is the difference between explode and split?
What is the difference between require_once and require in php?
Explain the difference between $message and $$message?