ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Scripts >> PHP
 
 


 

 
 PHP interview questions  PHP Interview Questions (658)
 ASP interview questions  ASP Interview Questions (251)
 CGI Perl interview questions  CGI Perl Interview Questions (76)
 JavaScript interview questions  JavaScript Interview Questions (174)
 VB Script interview questions  VB Script Interview Questions (338)
 JSP interview questions  JSP Interview Questions (99)
 Shell Script interview questions  Shell Script Interview Questions (158)
 Python interview questions  Python Interview Questions (5)
 Tcl interview questions  Tcl Interview Questions (19)
 Awk interview questions  Awk Interview Questions (6)
 AJAX interview questions  AJAX Interview Questions (24)
 Ruby on Rails interview questions  Ruby on Rails Interview Questions (21)
 Scripts AllOther interview questions  Scripts AllOther Interview Questions (48)
Question
what is interface in php? how it is use?
 Question Submitted By :: Nikunj
I also faced this Question!!     Rank Answer Posted By  
 
  Re: what is interface in php? how it is use?
Answer
# 1
Interface is a object oriented concept,
It is the place where we can define the function.
When a class use that interface in that class the total
function body part will describe.
after that we can call that function in other class and we
are get result.
 
Is This Answer Correct ?    67 Yes 23 No
Asish Kumar Khuntia(mithu)
 
  Re: what is interface in php? how it is use?
Answer
# 2
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 ?    105 Yes 15 No
Jadhav Yeshwanth
 
 
 
  Re: what is interface in php? how it is use?
Answer
# 3
Interface is a prototype of method body.
when ever we want to develop the application by third party
vendor people, at that time we have to provide only interface.
why because the people gives the implementation in their own
way so we have to provide the interface.
 
Is This Answer Correct ?    28 Yes 8 No
Thirupathi Rao
 
  Re: what is interface in php? how it is use?
Answer
# 4
in english? lol 
Is This Answer Correct ?    12 Yes 54 No
Johan
 
  Re: what is interface in php? how it is use?
Answer
# 5
Interface gets useful when you need to extend a class from
more than one parent class since class can not do this.

Why would you want to implement just a single interface on a
class. After all, a class already has everything that an
interface has.
 
Is This Answer Correct ?    13 Yes 7 No
Raju
 
  Re: what is interface in php? how it is use?
Answer
# 6
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 ?    20 Yes 4 No
Sanjeev Kumar
 
  Re: what is interface in php? how it is use?
Answer
# 7
Why you can :

interface FirstInterfName{
function Add();
function Sub(10,5); // this line can u pass 10,5 like this
}
 
Is This Answer Correct ?    2 Yes 6 No
Neakdek
 
  Re: what is interface in php? how it is use?
Answer
# 8
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 ?    14 Yes 6 No
Nur Nahid Hasan
 
  Re: what is interface in php? how it is use?
Answer
# 9
interface = multiple inheritance

means:
An interface is a named collection of method definitions, without implementation.

example:
interface interfaceName{
public function func1();
public function func2();
}

//we will use this interface as
class ClassName implements interfaceName
{
//note all interface func's must implement here
}
 
Is This Answer Correct ?    2 Yes 0 No
Sivannarayana
 
  Re: what is interface in php? how it is use?
Answer
# 10
interface =multiple inheritance

means:
An multiple inheritance is not supported in php that time we
using interface. It is implements two baseclasses but class
extends only one class.
 
Is This Answer Correct ?    2 Yes 0 No
Karthi
 

 
 
 
Other PHP Interview Questions
 
  Question Asked @ Answers
 
at present am learning lamp course sir ..i want to know the carrer prospectus in php ...is there any companies recruiting freshers in chennai ..for freshers how much can i demand as a fresher in php ....?i finished my mca ..please sugggest me to face interview in php asking salary details and all please suggest me how much can i ask as a fresher in php ? and also tel is there any openings in chennai for recruting php freshers send their emails and company info please ? please send ur valuable suggestions to kiranpulsar2007@gmail.com i hope u wil reply to my question thank u guys bye take care see u soon all the best to everyone Microsoft 1
•What is the difference between “mysql_fetch_array” and “mysql_fetch_object? Infotech 2
what server connected Wipro 1
hi abinashg i think u have experience in php plz tell me more about php now i raearlly want to do php wat is the future.my email id atul_saini2@yahoo.co.in.plz guide me thanks...........   2
can any one tell how to install LAMP server in terminal in ubuntu.....and also tell please how to run php files in ubunut and how to save and compile in ubuntu..i already installed ubuntu ..but i dont installed lamp server so i want to install lamp server in terminal is it possible please reply   2
How can we know the number of days between two given dates using PHP? How can we know the number of days between two given dates using MySQL?   6
How many requests will be send to server and response coming from server when you open a web page (e.g. xyz.php) which has an image tag? Persistent 2
How to find second highest salary   9
Suppose your Zend engine supports the mode <? ?> Then how can u configure your PHP Zend engine to support <?PHP ?> mode ?   4
What is the difference between PHP,ASP and JSP? T3-Softwares 3
What are the advantages and disadvantages of Cascading Style Sheets?   1
how to insert logout time when browser close   1
 
For more PHP Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright © 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com