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 are the popular content management systems (cms) in php?
Tell me will a comparison of an integer 12 and a string "13" work in php?
What is scope of variable in php?
Tell me what are the __construct() and __destruct() methods in a php class?
Which function is used to read a single character from a file in PHP.
What are advantages of .htaccess?
What are the disadvantages of php?
Write syntax to open a file in php?
What are php data types?
What is the use of header() function in php?
How long should a session last?
How do you compare strings in java?
Explain what is the function file_get_contents() usefull for?
What is the difference between file_get_contents() and file_put_contents() in php?
What is isset in php?