Can anyone help me to find some questions for php practical interview test ? I need some question in the following pattern .

1) what is the output of the following program ?

2) Some tough multiple choice questions

3) Write a PHP program to ......

6 Years
Discussion Span
Last Post by mschroeder

another thing the interviewers often tend to do is to give a php statement and remove commas, semi-colons, replace "" with '' and then they ask the candidate to repair their statement.


Hi macko.. thanx for your immediate response. I have already seen that URL. But all those questions are very simple. I need to conduct a WRITTEN TEST for PHP programmers with 3-4 years of experience.


Or some questions in the following model.

What will be the output of following script?
$array = array (1, 2, 3, 5, 8, 13, 21, 34, 55);
$sum = 0;
for ($i = 0; $i < 5; $i++) {
$sum += $array[$array[$i]];
echo $sum;


and also about regular expression, image uploads,creating thumbnails,php encrytion functions,php crons,PHP filters etc..
. What is the use of sprintf() function?
. What is difference between mysql_connect and mysql_pconnect?
. Notify URL and Return URL

Edited by Shanti C: n/a


You can ask questions about image resizing, paypal and other payment system integration, mysql joins, file handling etc.


Ask your candidate to write a small blog with basic functionality.
It need not to be a fully completed blog, just the basic functionality

As a help and make it fast you can
- Explain him the approach or the Design pattern you are expecting
- Whether you want MVC structure with fully OOP included or not
- Specify the mysql tables(Posts, Comments) or even fields if u want
- Ask him to write just the pseudocodes

From above test you can appraise the candidates,
Basic PHP knowledge,
Structural knowledge,
Basic SQL,
Design patterns
Organization and how fast he works

Also have a look there are some good php interview questions in phpinterviewquestions


Look at the Zend PHP 5.3 Certification Study Guide. (http://www.zend.com/topics/PHP-5-3-Study-Guide-v1.pdf)

Covers a broad range of topics and they have some very good questions that really make you think about what you're seeing.

e.g. What is the output of this code?

$a = 1;
$a *= $a;
echo $a--;

Sorry if this question looks stupid, but I don't understand what is the point to know such things that are not used often, for example -


I never use it in practice and don't remember it in other people code examples. I always use $a++

So whats the point to know things that are not used. I remember when I studied at univecity there was a lot of such things, that you know when you need to pass the exam, but after you pass, you quickly forget, because you don't use them.
When you are interviewed, why not better give some questions about practical things like paypal, database, some new technologies instead of what is the difference between ++$a and $a++?


Because ++$a and $a++ do two different things.

Just because you don't use them doesn't mean they aren't used.

A quick grep over the Zend Framework for example yields 46 files that use the ++$a syntax.

An interview would be used to determine your understanding of PHP as a language. When you start looking at specific technologies, e.g. PayPal, Database Connections, etc. these things will all vary greatly project to project and company to company.

This is why frameworks in large development environments are so common because a company worried about quality is not going to let you run free and just hack together code however you feel like it that day. A company that develops using Zend/Symfony/Cake/Doctrine for example would interview you on your Zend/Symfony/Cake/Doctrine Knowledge because it is documented and easy to establish a baseline for proficiency and understanding of the framework as well as PHP.

Figure even if the company has their own framework of sorts that they build all of their applications on. Anyone outside of the company would have a slim chance of being familiar with it. So they wouldn't be looking for your knowledge of XYZ framework that has been developed in house, they're looking for your understanding of core php and how easy it will be to familiarize you with their environment and get you up to speed with their standards.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.