Get your FREE 30 page Developing SOLID Applications guide!

PHP Interview Questions And Answers

Out Of Date Warning

Languages change. Perspectives are different. Ideas move on. This article was published on November 16, 2009 which is more than two years ago. It may be out of date. You should verify that technical information in this article is still current before relying upon it for your own purposes.

There are a large number of PHPers looking for jobs right now. After having just gone through the process myself, I wanted to put together some of the most common PHP interview questions. These questions are all non-technical, but do represent the soft side of PHP interviewing. I cannot help you if you don’t have the technical skills to answer the technical questions, but answering these questions correctly is often the key to making or breaking your chances with an interviewer who otherwise has fine technical candidates.

Why did you leave your last position?
This question is a hard one to answer, particularly if (like me) your departure was public. However, no employer wants to hear you beat up on another employer. They also don’t want to hear that you “outgrew” an employer (I learned that lesson the hard way). They fear they’re going to be next.

Be honest, but be able to present yourself in a good light. If you lost your job, be careful about how you phrase it. If you left or want to leave your current employer, find a reason that doesn’t make you sound flaky, flighty, or arrogant.

How did you get into PHP?
Work up a good personal anecdote when you prepare to answer this question. This is not a time for the answer of “I wanted to make a lot of money,” even if that’s the true reason. My guess is that it’s in fact not the true reason.

My answer is that I got into PHP because I had a particular problem I needed to solve: I was running an online roleplaying game and I needed to find an automated way to do the calculations involved. I tried Excel but one player didn’t own a copy and wouldn’t have been able to play. I tried ASP and .NET but hated them; PHP worked for me, and that’s how I got into it.

The above answer is the truth, and also has the qualities of being able to show an interviewer that I love the language I’m working in. This isn’t just a job, but a passion. If you’re passionate about PHP, think up a (true) answer that makes them feel good about hiring you.

Where do you ultimately want to be in life?
Contrary to popular belief, the interviewer is not interested in hearing about your dreams. They want to know how well you’re going to fit into their organization.

This is not the time to talk about your desire to start a business or go off to law school in two years (also a lesson from the school of hard knocks). This is a time to talk about how you want to become even better at what you do than you are now, and maybe graduate into a team lead. Keep it focused on the organization at hand. And don’t give too much away.

How many gas stations are there in Los Angeles?
The good news: there is no correct answer to this question so any answer will work. The bad news: this is a question of “how do you think?” without asking that specific question. You’re being graded on your approach to big, abstract questions.

There’s no true way to prepare for these questions, but when you get one, you need to be ready to answer it. Your best bet is to try and reason out an answer with the interviewer; use them as a resource to check your logic and come up with an answer. The answer is unimportant; the thought process is wholly important. So go with that.

These questions are generally rare, but come up in interviews that employ the “Microsoft style” of interviewing. The good news is that if you answer coherently and competently, you should be more than fine.

What’s your salary range?
Never ever answer this question with a number. You’d be surprised at the number of people who think answering this with a number is a good idea. If you answer the question with a number, you can guarantee yourself a salary no higher than that number, and worse, you may even eliminate yourself from consideration by naming a number that is too high.

There are a number of answers to this question. First, there’s the answer that “I am open to considering all offers, and I hadn’t really thought about a salary range.” If that doesn’t work, you can also try and explain that you felt undervalued at your last employer, and that you’d rather not come up with a number right now. Do what you can to be polite but to not give a number to your interviewer, if you can avoid it.

Do you have any questions for us?
You bet your ass you do! You want to find out how well they do on the Joel Test and things like core hours. Ask about dress code. Ask about equipment you’ll be using. Ask about the projects you’ll be working on. Ask to see your workspace.

You also will have the urge to ask about things like benefits package. Don’t. Do. Not. Ask. Those questions are reserved for AFTER you have an offer letter in your hands. That’s right – you ask about the benefits package after you have a formal offer of employment that you can accept or reject.

Bear in mind that the questions you ask will shape your interviewer’s viewpoint about who you are as a person. And worse, the question and answer period usually comes at the end of an interview, meaning it’s their last impression of you. Don’t blow it by asking stupid questions that make them think all you care about is how much time they’ll pay you for while you aren’t doing any work (a.k.a. paid time off).

Summary
While the technical questions of an interview are something that require technical knowledge, these “soft” questions are just as crucial and often can make the difference. Prepare to answer them, and their variants, because you will be asked about these things. Answer them well and you’ll have multiple offers to choose from, every time.

Write better object oriented PHP today.

Object oriented programming always leaves you with a headache. What if you could master it instead?

Get the book now! »

Rick wrote at 11/16/2009 3:35 am:

I disagree a bit about the salary stuff, I think that depends on personal circumstances. I know exactly what I’m worth in terms of market value, and I know what I need to live comfortably. In my experience, most companies tend offer a salary higher than the number I suggest, because they feel the competition will do the same (which is usually true).

If the number I give them is too high, it’s simply not a match. Unless it’s a start-up with limited funds, I don’t trust an employer that would skimp on developer salaries. Or they may not trust me to deliver but are desperate enough to offer me a contract anyway. Also something I really want to avoid.

Brandon Savage (@brandonsavage) wrote at 11/16/2009 6:55 am:

I’ve found in negotiating that the number you give them will never get any larger (or smaller if you’re negotiating a price). Best not to give them a reason not to pay you what they think you’re worth.

John Mertic wrote at 11/16/2009 8:29 am:

I agree with Brandon here; let your prospective employer throw out a figure before you do. And try to make salary negotiations the last part of the interviewing process; by that time both sides will have a better understanding of each other so the number given will be more realistic.

Jon Whitcraft (@sidhighwind) wrote at 11/16/2009 9:04 am:

Brandon,

Thanks for posting these good tips. I’m going through the exact same thing right now and I’ve got two phones interviews lined up today.

I’m defiantly now more prepared for them!

Eric wrote at 11/16/2009 1:04 pm:

I also disagree on the salary question. An interview is not the same thing as a salary negotiation. I answer this question with a range and leave the details about compensation to later on in the process.

Andries Seutens (@andriesss) wrote at 11/16/2009 4:22 pm:

I mostly agree with what Rick says. I find it ok to give a salary range. If the range is too high for the company it simply won’t work anyway. You should know what you are worth, and need to live comfortably.

Some companies are rude and even ask about your current salary at your current employer. You should avoid telling them that in any way possible. They have no business in asking, and it’s completely irrelevant.

Brandon Savage (@brandonsavage) wrote at 11/16/2009 5:53 pm:

If you want to give a range, that’s fine. But I have personally experienced the cost of doing so: an employer would have offered me $10,000 more if I had not given a salary range. Instead, my highest number became the highest number I could ever negotiate. Don’t do that to yourself.

Michael Kimsal (@jsmag) wrote at 11/18/2009 8:38 pm:

I’ve gone back to someone after giving a range upped it, and it worked. If you’re someone they’re interested in, they’ll work with you. Not everyone will, but some will. In my case, I would have been moving out of town for them, and said that after discussing things with my wife, I’d realized the range I’d given was not quite where we needed to be. They accepted that. The range was only about $8k higher – it wasn’t *outrageous*. To that end, I understand Brandon’s point about locking yourself in ‘too low’.

I find that it’s courteous to give people an idea of what range I’m looking for early on, even before a ‘formal’ interview. Done properly, it’s courteous and respectful of the time of both parties, and I can often refer them to someone else who might be a better fit based on skills, money range, location, etc.

I get recruiter calls probably 3-4 times per month, which I realize isn’t the same as applying to a company directly, but it’s so much easier to get money/ranges out of the way up front.

If someone’s only capable of paying $15/hour and you’re looking for $90/hour, there’s very little point in wasting anyone’s time. If they’re thinking 40 and you’re thinking 45, that can be the time to be a bit cagey, and knowing how to recognize those situations (imo) mostly comes from experience.

Hari K T (@harikt) wrote at 11/21/2009 1:00 pm:

Yes I too agree with @andriesss about the current salary . I don’t know why people are asking the current CTC .
They want to compare the range we are asking and they don’t love to give us what we ask .
Good post Brandon .

Alexandr wrote at 11/28/2009 10:08 pm:

Brandon, I didn’t understood why you think that salary range need to be one number?

More I have write in my resume two numbers
– what salary I agree to have
– what salary I want to have
and be sure that I want is reasonable for me, and it isn’t for boss. Someone who don’t want to know what I want and isn’t ready to help me in this – can not be my boss.