free classified ads and leads
domain website price

PHP developer interview questions


PHP developer interview questions

If you are giving the interview and your interviewer is not know the answer then your chance is sure to appoint as php developer. BEST OF LUCK.


  1. What are the current versions of Apache, PHP, and MySQL?

Apache – 2.0.63
PHP -  5.3.0
MySQL – 5.0.48

  1. What is a cookie and how is it useful?

Cookie is used to store temporary data for a time period. Cookie can be disable at client machine.

  1. If you run into a problem while coding, what steps do you take to find the answer?


  1. What files are commonly found in these standard UNIX directories?




  1. When you want to show some part of a text displayed on an HTML page in red font color, what different possibilities are there to do this? What are the advantages and disadvantages of these methods?

<font color=’red’>Test Font</font>
Using CSS
STRONG{ color:red}
<strong>Test Font</strong>
<span class=’colorClass’>Test Font</span>

  1. What's the difference between and

If you add color through <font> tag and in future if you wish to change then you will change one by one on all pages. But if you use through CSS you need to change on a single file.



  1. What is the primary advantage of CSS?

You can change the color of whole site with in second, because you will create a single class for heading color. You can easily update the color link pink, green and other colors.

  1. Describe the different ways to have content initially hidden on a page?

Hidden a div.

  1. Explain the purpose and implementation of a float?

1) I have 3 boxes: box1, box2, and box3, which are divs.

2) box1 has style float: left.

3) According to "CSS Mastery", an element that is floated is taken out of the normal flow, and the other elements behave as if the floated element doesn't exist. Therefore, box2 moves to the top of the page with box3 underneath it. The floated box1 then covers box2.

What I see in Safari 3.0.4 and Firefox 3.0.8(Mac) is box2 and box3 on top of each other and positioned under box1. If I was shown only the output and not the style sheet, then based on what I read in "CSS Mastery, I would have guessed that box2 was floated.

  1. Describe the inherent CSS differences between IE and Mozilla.



  1. How can we submit a form without a submit button?

We can submit form through
Onclick =”document.formname.submit();”

  1. Do you use DHTML and Javascript? Describe the projects you've used them in.
  2. Describe some methods to redirect a page in Javascript and PHP.



  1. What is the difference between $message and $$message?
  2. What are the differences between PHP3, PHP4, and PHP5?
  3. How can I execute a PHP script using the command line?
  4. How can we increase the execution time of a PHP script?
  5. What are public, private, protected, and static methods?
  6. What is an abstract class and interface?
  7. What is meant by urlencode and urldecode?
  8. How do you set a session variable?
  9. How do you set a cookie? How about reading the value within the same page execution?
  10. What are two different ways of unsetting a cookie on the user's machine?
  11. How do you encrypt data using PHP?
  12. What is the difference between an enumerated array and an associative/hashed array?
  13. What are the differences between require, include, and include_once?
  14. How do you increase the allowable execution time of any PHP script?
  15. What will this output? <?php $a = false; $b = true; $c = false; if ($a ? $b : $c) {   echo 'false'; } else {   echo 'true'; } ?>
  16. What will this output? <?php $txt_var1 = "PHP"; $txt_var2 = &$txt_str1; $txt_var2 = "MySQL"; echo $txt_var1 . $txt_var2; ?>
  17. What does this do? <?php if (isset($_REQUEST)) while(list($varname, $varvalue) = each($_REQUEST)) { $$varname = $variable; } ?>



  1. How can we repair a MySQL table?
  2. A select query over a large table runs very slow because of the growing number of entries in a table. What different measures could be taken to improve speed?
  3. What are different types of tables in MySQL and their differences.
  4. What is the difference between GROUP BY and ORDER BY in SQL?
  5. How do you encrypt data present in a MySQL table using MySQL?
  6. What is an EXPLAIN? What does its result look like?
  7. What is an alias? What elements can be aliased and how would one do so?
  8. What are 3 different methods of adding data to a table?
  9. What is the difference between "DELETE FROM [...]" and "TRUNCATE TABLE [...]"?


Elaborate on the following acronyms:


Q: When working with strings, which is more efficient single quotes (') or double quotes (")? Why?
Q: When working with forms, which variable is better to use:
$_GET and $_POST
Q: Correct all the mistakes in this code according to PHP5 specifications, make sure it properly outputs the word "hello":
function __construct($str)
$my_variable = $str;
$object_variable = new simple_class("hello");
echo $object_variable=>$my_variable;
Q: Correct any/all mistakes in this query:
SELECT username, email WHERE id = "1341" FROM users ORDER BY username ASCENDING LIMIT 1;
Q: What is the md5() function good for? Name a few uses.
Q: What is password salting, when should it be used?
Q: If I have a string that has line breaks (n) in it, and I want to convert the string to html with proper line breaks (<br >), what would be the simplest way to do this?
Q: When should print_r() be used?
Q: What's the difference between == (two equals) and === (three equals)?
Q: What is XSS? How can you safeguard your code from XSS attacks?
Q: What's wrong with this code?
$users = mysql_query("SELECT username FROM users WHERE id = '".$_GET[id]."'");
Q: Give an example of when to use references in a function.
Q: If I want to declare a constant variable, what function should I use? What can constants variables be used for?
Q: What are indexes used for in mysql? When should you use them?
Q: Create a function that will covert the timestamp "1101166483" into the formatted date "January 3nd, 2008 4:34pm" (date and time will not be the same).
Q: What's the easiest way to read the contents of a file into a variable? What if the file is very big (more than 100mb)?
Q: How can I check if a variable exists?
Q: A user loads myscript.php, I want the user's browser to be redirected to myotherscript.php, how can I do that?


Language Related

1.How do you think PHP compares to other similar languages?
2.Describe a PHP project you have worked on recently, and what you learned.
3.Explain what magic quotes are, and if you think it was a good idea or not.
4.What's the difference between == (two equals) and === (three equals)?
5.What PHP functions you use the most, and what do you use them for?
6.What is the difference between require_once(), require(), and include()?
7.What is the effect of prefixing a function with an @ symbol (e.g. unlink() and @unlink())?
8.What is the difference in using single quotes or double quotes for a string?
9.What is the “try” command used for, and how is it limited in PHP?
10.What is inheritance and can you give an example of when it could be used?
11.What is php “safe mode” used for, what are it's pros and cons?
12.Why can PHP not set headers after using echo?

Security Related

1.What is password salting, when should it be used?
2.What is the md5() function good for? How can you undo what it does?
3.What is XSS? How can you safeguard your code from XSS attacks?
4.What is SQL injection? How would you protect against it?
5.What is PHP Remote-file-inclusion?

Database Related

1.What databases have you used, and what are your opinions of them?
2.What are indexes used for? When should you use them?
3.What does it mean to normalize a database? Why is it important?
4.What is a JOIN and what kinds are there?
5.What is a transaction, and when would it be useful?
6.What is database abstraction, and have you used any specific libraries for this?

Web Related

1.Explain why CSS is important.
2.How would you make the website get data from the database without reloading the page?
3.What is jQuery and what types of things would you use it for?
4.What is the difference between HTTP and HTTPS, when should the latter be used?
5.What is the difference between server side and client side?

General Programming Related

1.What is a code repository used for, and which ones have you used?
2.What OS do you program on? What IDE or text editor do you use for PHP?
3.What are design patterns and which ones have you used if any?

Bookmark and Share


Related Topics


Submit Reviews:

(Enter the characters seen on the image below.)

Promotional Ads


Packers and movers in Mohali
Plot No 636, Near HP Gas Agency, Dariya, Chandigarh - 160101

Submersible Sludge Pumps
18, shreenath Estate, cross road, nr. Nikol, nr. Sardar Patel Ring Road, Kathwada, Gujarat 382415

Bhakti Bird Proofing
House no.9479 durgamata tekdi vibhag, mahalaxmi nagar, City ambernath, Near durgamata temple. Pin Code-421501
Motilal Nagar Mumbai

Livonta Global Pvt.Ltd
1110, Colonnade, B/H Iscon Temple, Opp. Iscon BRTS Bus Stand
Iscon - Ambali Rd,

Brij Agnihotri & associates company secretaries
3454, 40D, Sector 40D, Chandigarh, 160036, India

JB Rock Bolts & SN BOLTS
10 A & B Industrial Area (at Vill. Nangal Jarialan)
Distt. Una Himachal Pradesh

Govinda resorts Lonavala
Old Mumbai - Pune Hwy, Maval, Lonavala, Maharashtra 410405

Steelco Metal & Alloys
192 – Minara Mansion, Shop No.6, Sant Sena Maharaj Marg, 2nd Kumbharwada Lane, Mumbai, Maharashtra 400004
Mumbra Mumbai

Best Resorts in Dharamshala Amid the Misty Hills.

Genius Global School
194 Anand Vihar Saproon, Solan, Himachal Pradesh
Ambala Cantt