PHP interview questions
PHP is a programming language designed to create dynamic web pages and work on the server side, nowadays there are millions of websites based on PHP, and also more and more PHP programmers, companies are looking for this type of programmers so if you need PHP interview questions then this site is perfect, no matter if you are looking for a employer or a employee. Between the most popular we can find:
Programming in PHP is currently very popular and creating a website based on this language is a good decision due to various reasons, there are lot of manuals, both printed and online, free online tutorials, it is under PHP License, which is compatible with GNU License, it is easy to learn and more.
If you are sure you need to hire a PHP programmer then check out the list below, there you will find useful questions to ask the interviewee and know if he/she is the most indicated for the job.
PHP interview questions and answers
Can you explain what PHP is and how it evolved through the years?
Beside all the written above about PHP, it is important to hear what the interviewee knows about it and his/her experience, the answer will provide us a contrast between his/her experience and the answer.
What types of variables can we find on PHP?
On PHP there are four basic types of variables, integer, double, string and arrays, we should also know that on PHP you do not have to declare a variable, they just turn into any type automatically by assigning them different type of values.
What is the difference between single and double Quotes?
It is different, there is a range of examples to prove this, beside the performance speed, this is the simplest one:
$var = "hello";
echo "$var world";
//Result: hello world
echo '$var world';
//Result: $var world
Explain the Post and Get methods
Both methods are very used, but the basic difference is this; the GET method send the information using the URL and the POST method send the information through the standard entrance.
There are a lot of Array Functions, Can you name some of them and how they work?
Arrays are extremely useful for programmers, they are used to store data and recover it whenever they want, so it is a good idea to get sure they know about them.
Can you explain how are classes used in PHP?
PHP is an object oriented programming language, but classes are not implemented the same way they are in other languages, for example c#. They are very useful, so it is a good idea to be sure the interviewee knows to work with them.
Can you create subdomains using PHP? If the answer is yes, How?
This question will probably be unknown for many programmers; anyway, if the control panel is not working properly, there are other ways to create subdomains.
When do we use the @ symbol before functions?
The answer is very simple, to suppress the errors or warning displays that function can generate.
When you compare 2 arrays, is there any difference if you use "==" or "==="?
There is a difference, by using "==" you will compare the values on each array, and by using "===" you will compare the values and also the data type contained.
For example by using just 2 variables:
$var1 = 4;
If($var1 == $var2) // You will get true
If($var1 === $var2) // You will get false
What types of inheritance are supported by PHP?
Actually PHP only supports one type, the single inheritance.
Take into account that you can ask for questions to be answered, but you can also ask for questions to be resolved, you can measure the creativity of the interviewee by making him/her think about solving problems that can be quickly resolved using built functions, for example, extract the 6th letter of a word without using an already built function, or a simple and interesting exercise, for example, solving the Fibonacci sequence. When it comes to PHP interview questions, you can also use your creativity.