PHP Interview Questions and Answers

One of the most crucial parts of web services is PHP. Every web developer who look forward to enter in this field must know PHP. To crack the interview of PHP, brush up your basic knowledge associated with it. Take your time to prepare yourself and understand all the common pattern of questions that are usually asked by the interviewer. Understanding the questions and its relevant answer will surely help you become the right PHP coder.

PHP Interview Questions and Answers

Interview Q&A of PHP are ;

Can you tell us more about yourself?

You need to answer about your personal and educational background. Kindly highlight those points in your work profile that is associated with PHP coding. This will help the interviewer get a better idea on what type of coding have you worked in earlier.

For how long have you been working in this field?

With this question, the interviewer is trying to judge your work profile and understand how well grasped personality you are and whether the knowledge and experience that you acquire can be helpful for them or not.

Can you tell us about PHP?

The full form of PHP is Hypertext Pre-processor. It is an open source server scripting language which is generally used for web development. With this type of coding web pages get generated more quickly and efficiently.

Brief us about PEAR in PHP?

PEAR is an abbreviation used for PHP Extension and Application Repository. It is repository and a framework which can be used as a PHP components. It generally has got libraries and coding associated with PHP.

What does submit button in PHP mean?

This button is made using PHP coding. To get this task successfully done, it has to be linked with the any field form event trigger and then command the document.form.submit() function in JavaScript code

Do you think that you can work with our company for a long time?

When the interviewer asks this question in middle of the serious discussion of PHP, it means he is checking your flexibility. Give your assurance and tell the interview why this job is so important for you.

Can you explain us the difference between POST and GET methods?

In Get method, it is possible to send around 1024 bytes where as in case of POST method, it is possible to transfer pretty huge amount of data. As compared to GET method, POST method is quite secured.

Do you know the right way to declare a PHP array?

This might sound you a simple question, but remember, you are being asked this to check how quick you can give the example associated with it. Give an appropriate answer for this with example like: “var $arr = array(‘apple’, ‘grape’, ‘lemon’);”

Brief as about your work profile?

If you are a fresher, then try to explain them your working span in the projects that were assigned to you in college. If you were in some other company earlier, then try to explain them the projects that you had undertaken in that span of time and how it proved useful or the company. In your work profile, try to highlight more of the relevant experience.

Please brief the importance of ‘print’ in php?

It is ideally not a real method but more like a language construct. So that we can use this type of word in your coding without any parentheses symbols with it’s argument list. We can exampling them better with an example like:

print(‘ Spinterview.Com’);

print ‘Job Interview ‘;

Can you tell us about in_array() that is used in php ?

This type of function is used to check, if there is any kind of a value which exists in an array.

Do you know the importance of count() method in PHP scripting ?

Here explain them the real importance of this coding. It is generally used for counting the elements are present in an array or to check something in the object.

Explain the difference between require and include?

In case there is any kind of failures then these two come into existence. If a particular file is not obtained by require,it is an error being displayed while execute will be stopped in case of include, although an issue for waiting is given but execution is not stopped.

Explain the difference between Session and Cookie?

The difference is pretty simple, the storage of session is done on the server where as that of the cookeries is done in the text file format of the computer of the user.

Give one example to set the “cookies in PHP”?

Here you simply need to tell an example about PHP cookies.

Do you know the process to get a Cookie Value?

If there is an example that can give the answer of your interviewer, then instead of giving any explanation, end the topic .

Please explain us how to remove the data from the session or making a session and if there is value to be set how to do that?

Here you simply need to explain them the process to make the session, remove the data and set the value with the right coding like:

Do you know the loops in php?

The loops that exist in PHP are for each, while, for, do. Be ready with their usage as well as interviewer might ask the question on the same.

Explain the code to make MySQL connection?

For mysql connection, you need to type “mysql_connect(servername,username,password);”

Do you know the right way to select a DB (database)?

With such question, the interviewer is trying to understand your in depth knowledge with regards to PHP coding, explain the interviewer with the right coding which is mysql_select_db($db_name);

With all the best possible answers, you will certainly crack the interview and impress the employers.

Leave a Reply

Your email address will not be published. Required fields are marked *