Top PHP Job Interview Questions and Answers for 2016

pb3Top PHP Job Interview Questions and Answers for 2016 –  Are you going to face an interview for PHP job and looking for top asked interview questions. Here we are providing a list for the question and their answers which are very common but very frequently asked in interviews conducted for the PHP related jobs. Every company has their own criteria for interview and questions are totally depends upon your role for the job and your skills also.

PHP interview questions



Q. Tell something about PHP.

Ans. PHP stands for: Hypertext Preprocessor. PHP is a server side scripting language which is used to develop the dynamic websites.

Q. What is MVC?

Ans. MVC stands for Model, View, and Controller. PHP MVC is an effective way to manage the code into 3 different layers.

Model:  Model represents the information in application.

View: View represents the visual representation of information and data that you have entered in the application.

Controller: Controller is actually how and in which way you want to read the information in application.

Q. What are the different types of CSS you can add in a page?

Ans. There are three types of CSS that can be added in a page.

1. External CSS.

2. Internal CSS.

3. Inline CSS.

Q. Does PHP support multiple inheritances?

Ans. No, PHP support only single level of inheritance. A class can be inherited from a single class using keyword ‘extended’.

Q. What is the difference between echo and print?

Ans. Initially both look same because both used to display any value. Main difference between echo and print is that echo is just used to display any string in output. It will display whatever is passed to it but on other hand print is a function itself it not only display any value but also can return value.

Q. What is the difference between GET and POST method?

Ans. Whenever we fill any form on internet we can used one from two methods to send data on sever computer, that method can be either GET or POST. When we use the GET method all information is displayed on address bar. If can sent up to 1024 of data using GET method so it is good to use only when we are working with small scale applications and data is not that much sensitive. If we talk about POST method, No information will be displayed on address bar and we can send up to 2 mb of data using POST method. This limit can also extend further if required. PHP includes many CMS systems which can be used to handle the web content in a effective way.

Q.What functions are used to get the image size, Width and Height?

Ans. getimagesize () to get the size of an image

Imagesx () to get width of an image

Imagesy () to get height of  an image.

Q. What is PEAR in PHP?

Ans. PEAR stands for “PHP Extension and Application Repository”. PEAR provides an inbuilt library of open source code for PHP developers. It provides support for package maintains and code distribution.

Q. How do you upload videos using PHP & MySQL?

Ans. We just need to copy the path of stored videos in the database rather than storing the videos files itself. All videos will be saved on a different folder and videos can be called from that folder when ever required. Default size is 2 mb for video files but we can change that size from max_file size option in php.ini file.

Q. What are the different types of errors in PHP?

Ans. There are three types of errors encountered in PHP.

1. Notice: These are very normal and non-critical errors and they even not displayed to users. For examples accessing a variable that not existed at all.

2. Warning: These are little bit critical errors. These results are displayed to users but do not affect the output of code. For example trying to include any file that is not exists.

3. Fatal errors: These are really critical errors. For example calling any non existence class.

Q. How constants are defined in a PHP script?

Ans. Define () is used to define constants in PHP.

define (“Newconstant”, 30);

Q. How can we submit a form without using submit button?

Ans. We can use the hyper links to submit a form if we don’t want to use submit button. We have to use some java script code for that.

<a href=”javascript: document.myform.submit();”>Submit Me

How to create an array of a group of items inside an HTML form ?

We can create input fields with same name for “name” attribute with squire bracket at the end of the name of the name attribute, It passes data as an array to PHP.
For instance :


Object orientation is a software/Web development methodology that is based on the modeling a real world system.An object is the core concept involved in the object orientation. An object is the copy of the real world enity.An object oriented model is a collection of objects and its inter-relationships

How do you define a constant?

Using define() directive, like define (“MYCONSTANT”,150)

How send email using php?

To send email using PHP, you use the mail() function.This mail() function accepts 5 parameters as follows (the last 2 are optional). You need webserver, you can’t send email from localhost. eg : mail($to,$subject,$message,$headers);

How to find current date and time?

The date() function provides you with a means of retrieving the current date and time, applying the format integer parameters indicated in your script to the timestamp provided or the current local time if no timestamp is given. In simplified terms, passing a time parameter is optional – if you don’t, the current timestamp will be used.

What is the maximum filesize that can be uploaded in PHP and how can we increase it?

Ans. By default the maximum size of a file that can be uploaded is 2MB. you can change the maximum uploaded size value inside php.ini file set the value upload_max_filesize = 5M and restart all the services.

How can we increase the execution time of PHP ?

Ans.By default the maximum execution time of a PHP script is 30sec. If you want to change the following setup go inside php.ini file set max_execution_time = 40;

How can we get the value of current session id?

Ans. The session_id( ) function is used to get the current session id. It returns the session id for the current session.

How can we submit a html form without a submit button

Ans. The submit( ) function is used to submit form. first you have to get html form id through this document.getElementById(“formId”).submit() and then use submit( ) function. call this javascript function inside html body section at onclick=”your funciton name( )” events. set form action when you want to display the output, fetch the data on php and display your output

Top Searches:

  • php interview questions and answers for experienced,
  • php interview questions and answers for freshers,
  • php interview questions and answers pdf
  • php tutorial,
  • mysql interview questions,
  • php interview questions and answers for freshers pdf,
  • php interview questions pdf,php interview questions for freshers

Book a fee php demo class or call for free career help : 9878375376 

Courses: , , , , , , , , ,