Top 5 Classic Questions at PHP Interviews

Job interviewPHP programmers tend to submit CVs to and have job interviews in many companies before they finally select the right position. So if you asked an experienced PHP developer for a set of questions employers are most likely to ask during the technical interview, they’d give you the following list of questions.

Here we also provide the correct answers to refresh your memory and some further guidance to help you feel confident when it comes to PHP interview questions.

  1. What is OOP (Object Oriented Programming)?

They often make a question rather open-ended to let you dwell on it. To answer smartly you should know about classes, abstract classes, interfaces, properties, methods, inheritance, etc. It’ll be also good if you state the reason why OOP proves more helpful than procedural programming. You can study the topic here.

  1. How a class differs from an interface in PHP?

Interfaces do not have business logic. They only have method signatures which define a template every class implementing the interface should contain.

  1. What is MVC?

You probably already know this, but usually interviewers are looking for some deeper understanding of this model, as well as fair explanation of how, why, and when it is used. Simply put, the Model-View-Controller paradigm is a way of structuring your code in 3 separate layers where each does their own job. Model normally contains all business logic and data access code. View Contains markup or design code in HTML, XML, JSON, etc. Finally, Controller usually contains little code needed only to call your Model code, as well as render your View code. Here you’ll find more examples.

  1. How is a PHP session happening?

It works like this. The PHP session cookie gets created in the browser of the client. On every request that cookie is sent to the server by the client. Then PHP uses the cookie to select corresponding information about the session. By default session data are stored in files, but you can store your sessions in the database, too.

  1. What are the biggest PHP changes so far?

You can mention PHP 5.0 which implemented the object model, PHP 5.0 which added PDO, PHP 5.3 which got namespace support, etc.

You won’t look like a genius with this set of prepared answers, but with these minimum managed you are definitely not going to fail either. The rest is up to you and your learning efforts.

Good luck!