Skip to main content
php interview

Basic PHP Interview questions with answers for Freshers

php interviewCracking a PHP Interview at a reputed company requires strong knowledge of trending topics in the language. Freshers are asked basic PHP questions that are needed while working on live projects. So Interviewee must have the knowledge of the popular and trending topics of the industry. Here we have summerise the most commonly asked PHP interview questions for freshers along with Interview tips.

Most common PHP Interview Questions for freshers

If you are applying as a fresher you must be clear with the following questions/topics in order to qualify.

1. What is PHP?


  • PHP or “PHP: Hypertext Preprocessor” is a server side scripting language.
  • It is usesd to develop web applications.
  • PHP is an Object Oriented Programming Language (OOP).
  • Apart from dynamic websites, PHP is used to create many popular CMS such as WordPress, OSCommerce, Joomla etc.
    (You might get your next question on OOP, which is a very important topic. I have described it below)

2. Tell me some popular usages of PHP?

Below are some common uses of PHP −

  • You add, delete, modify elements within your database thru PHP.
  • PHP performs system functions, i.e. from files on a system it can create, open, read, write, and close them.
  • It can access cookies variables and set cookies.
  • By using PHP, you can restrict users to access some pages of your website.
  • PHP can encrypt data.
  • PHP can handle forms, i.e. gather data from files, save data to a file, thru email you can send data, return data to the user.

    3. What is echo in PHP and tell me the difference between echo & print?

  • echo & print both are used to get output. echo has no return value where as print has a return value of 1.
  • echo is faster than print
  • echo can take multiple parameters where as print takes only one argument
  • print is not actually a real function, It is a language construct. So you can use with out parentheses with its argument list.
    Example print(‘PHP Interview questions’);
    print ‘Job Interview ‘); The same is not true for echo.
  • Read more on print & echo here

4. Define include() & require() and their features.

  • We can include a file using “include() ” or “require()” function with file path as its parameter: such as : include (filename.php); or require(myfile.php);
  • include() and require() both are used to include a file while executing the current file.
  • If the include file is missing, the script will show warning message on execution but if we use require(), the script will show a fatal error on execution.

5. Explain GET & POST method in forms?

  • Both GET & POST methods are used to transfer data on a form.
  • Using GET method, you can only send 1024 bytes of data, however POST method can transfer any amount of data.
  • POST is secure than GET. As when you use GET method, data is displayed in the URL section. That is the reason we donot use GET while sending important information (such as passwords).
  • GET method creates a bookmarkable URL where POST doesn’t
  • You can set cache while using GET but the same is untrue while using POST.

 Tips from Interviewers

I have been into the industry for over 6 years & as an interviewer, the goal is to check the concept of the candidate by asking relevent questions on different topics. – Piyush Gupta, Senior Developer

 For PHP developers, the Interview starts with some basic questions but we cover all the aspects of PHP programming to know how deep your knowledge is. So donot lose hope when you find some tough questions from interviewer. –Deepak Kumar, PHP Developer



cPanel Level 1 Certified from cPanel University. Linux System Admin.

Leave a Reply

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