I was thinking about good questions to ask while interviewing PHP developers. Most of the ones you see on internet ask either much to specific stuff that the developer doesn’t really need to know by heart anyway (like “Which parameters does preg_replace() accept?”) or have little to do with web development at all. Some interviewers like to ask developers to complete test tasks during interview, which is in my opinion much better, but in my experience a lot of those tasks are far from what developer is actually going to do in his day-to-day work.
So here are some questions in no particular order that I would suggest asking people during an interview. I won’t post answer to most of these, since if you are interviewing someone you probably know the answers anyway.
- How do extensions like XCache or APC speed up PHP applications?
- What are the pros and cons of using Nginx vs Apache?
- Your application is performing slower than you would like, how will you investigate where the bottleneck is?
A good answer should mention using XDebug to profile the webapp - What new features were introduced to PHP in version 5.4? How about 5.5?
- What are Composer class maps?
- What are the options of making cross domain AJAX requests?
Not really a PHP question but it shows ome more in-depth knowledge - What is dependency injection and why is it important?
- Do you write tests for your application?
- What are the downsides of using singletons and how can they be replaced?
- What is Late Static Binding?
- You have a MySQL database with Posts and Tags tables linked using a third Post_Tags table. Now imagine you have to create an HTML table that would have two columns: name of the post, and a comma separated list of links to individual tags. Each link looks like this TAG_NAME ( so you need tag id an name to construct it). Try making it as efficient as possible.
The naive approach of selecting all posts and then all tags for each post would be very slow if you had hundreds of posts. A much better way to approach this would be using GROUP_CONCAT to select 3 columns from database: name of the posts, a comma separated list of tag ids and a comma separated list of tag names. Then using PHP you could explode comma separated list and costruct tag links. This question is probably best suited for developers that had some solid experience. - Is it possible to create a function that returns numbers from 1 to infinity that you could iterate over?
Use of generators - What is hash salting and why is it important?
- How to make variable from the current scope available in a closure (anonymous function)?
I need to make a short break now, i’ll add more questions to this list later on. Feel free to comment if you have any ideas.