Preetam Chari contribute her experience as follow:
Question1] What is the difference between an abstract class and an interface? Give a real time example when you will an abstract class over an interface?
Question 2] What is the use of final keyword?
Question 3] Explain function overloading and function overriding with an example?
Question 4] Explain the type of inheritance supported by PHP?
Question 5] Explain different access specifiers in PHP with examples?
Question 6] Is there any difference between exit() and die() in PHP?
Question 7] How do you set a cookie in php?Explain the different parameters?
Question 8] Where does cookie get stored?
Question 9] Where does session get stored?
Question 10]What is the difference between session and cookies?
Please share the answer if you know.
Tags: php, php faq, php interview question
July 2, 2011 at 4:38 pm
Good questions…. these are some of the common questions asked in many php interviews.
I can answer the second question.
The final keyword is used to indicate that a method cannot be overridden and the value of a final variable cannot be changed.
July 2, 2011 at 4:42 pm
My answers to some of the above questions:
4. php only supports single inheritance.
5. public, private, protected.
6. exit and die are almost similar, but using die(), we can specify a custom error message.
7. setcookie(name, value);
8. browser side
9. server side
10. sessions will expire only when we manually delete them, but a cookie can expire when the browser is closed.
July 2, 2011 at 4:43 pm
sorry, my answer to the eighth question is “browser side”… it is not shown correctly in my previous answer…
July 4, 2011 at 11:32 am
Answer 4: Single inheritance and Multi-level
July 4, 2011 at 11:36 am
@pritisolanki How does php support multi level inheritance?
I am sure that php does not support multiple inheritance.. but what is the multi-level inheritance in php ?
July 6, 2011 at 12:46 pm
Multi level inheritance is as follow
class A { // parent class}
class B extends class A {//child class}
class C extends class B{//sub child }
Also we know that we can’t extend multiple class to one class i.e. multiple inheritance is not supported in PHP.
Regards,
July 18, 2011 at 7:47 am
its mean class C can access the B and A both classes .
July 25, 2011 at 1:27 pm
as per the access modifier defined in the classes