Priti's Technical Corner

December 29, 2008

PHP Interview Questions

Filed under: Interview, PHP — Tags: , , , , , — pritisolanki @ 4:10 pm

Questions 1: Can we get  list of all constant in out program defined by define();
Answer 1: Yes, by get_defined_constants() we can list the constant and values.

Question2: If two interface have same method name can we implement both simultaneously.
Answer 2:No, it will create ambiguity

Question 3:what is Overloading in PHP

Answer 3:Overloading in PHP means to create methods and members dynamically.All overloading method must be defined as public.

Question 4: what is Factory pattern?

Answer 4: The Factory pattern allows for the instantiation of objects at run time. It is called a Factory Pattern since it is responsible for “manufacturing” an object.

Question 5: what is Singleton pattern?

Answer 5 :The Singleton pattern applies to situations in which there needs to be a single instance of a class. The most common example of this is a database connection.

Question6:How you can control the php script output?

Answer 6:By using output bufferring function like ob_start() and ob_end_flush() to control the script’s output.


December 21, 2008

PHP Interview Questions

Filed under: Interview, PHP — Tags: , , — pritisolanki @ 3:56 pm

Question 1: Explain various types in PHP?
Answer 1:
There are Four scalar types: Boolean, integer, float, string
Two compound types: Array, object
Special types: resources, NULL
Pseudo types:mixed,number,callback.

Question 2: What is regular expression?
Answer 2: regular expressions provide a concise means for identifying string in subject string.

Question 3: what is Type juggling?
Answer 3: PHP does not require (or support) explicit type definition in variable declaration; a variable’s type is determined by the context in which the variable is used.

Question4: What is difference between “heredoc” and “nowdocs”?
Answer 4: Nowdocs are single quoted string where as heredocs are double quotes string in which variable is parsed to its value.

Question 5: What is complex syntax?
Answer 5: when in PHP you want to use complex expression {} is used.
Ex: echo “this is {$g}”

Older Posts »

Blog at

%d bloggers like this: