PHP Interview Questions and Answers, PHP Interview Questions and Answers Freshers, PHP Interview Questions and Answers, PHP Interview Questions

Before getting on to the PHP interview questions, the student must know that the PHP is a continuously varying field which needs the students as well as professionals to upgrade their skills with the new features and knowledge, to get fit for the jobs associated with PHP. This post related to PHP Interview Questions and Answers, PHP Interview Questions and Answers Freshers, PHP Interview Questions and Answers, PHP Interview Questions will help you let out find all the solutions that are frequently asked in you upcoming PHP interview.

Over thousands of vacancies available for the PHP developers, experts must be acquaintance with all the component of PHP technologies. This is necessary for the students in order to have in-depth knowledge of the subject so that they can have best employment opportunities in the future. Knowing every little detail about PHP is the best approach to solve the problems linked with problem.

APTRON has spent hours and hours in researching about the PHP Interview Questions and Answers, PHP Interview Questions and Answers Freshers, PHP Interview Questions and Answers, PHP Interview Questions that you might encounter in your upcoming interview.  All these questions will alone help you to crack the interview and make you the best among all your competitors.

First of all, let us tell you about how the PHP technology is evolving in today’s world and how demanding it is in the upcoming years. In fact, according to one study, most of the companies and businesses have moved to the PHP. Now, you cannot predict how huge the future is going to be for the people experienced in the related technologies.

Hence, if you are looking for boosting up your profile and securing your future, PHP will help you in reaching the zenith of your career. Apart from this, you would also have a lot of opportunities as a fresher.

These questions alone are omnipotent. Read and re-read the questions and their solutions to get accustomed to what you will be asked in the interview. These PHP interview questions and answers will also help you on your way to mastering the skills and will take you to the giant world where worldwide and local businesses, huge or medium, are picking up the best and quality PHP professionals.

This ultimate list of best PHP interview questions will ride you through the quick knowledge of the subject and topics like databases, tables, PHPMyadmin. This PHP interview questions and answers can be your next gateway to your next job as a PHP expert.

These are very Basic PHP Interview Questions and Answers for freshers and experienced both.

Q1: What is PHP?
A1: PHP is an open source server side scripting language commonly used for web applications.

Q2: What is Open Source Software?
A2: Software in which the source codes are freely used, modify, and shared by anyone are called Open Source Software. These can also be distributed under licenses that adhere with the Open Source Definition.

Q3: Differences between GET, POST and REQUEST methods ?
A3: GET and POST are used to send information from client browser to web server. In case of GET the information is send via GET method in name/value pair and is URL encoded. The default GET has a limit of 512 characters. The POST method transfers the information via HTTP Headers. The POST method does not have any restriction in data size to be sent. POST is used for sending data securely and ASCII and binary type’s data. The $_REQUEST contains the content of both $_GET, $_POST and $_COOKIE.

Q4: What are the different errors in PHP?
A4: There are 4 basically types of error.

Parse Error – Commonly caused due to syntax mistakes in codes e.g. missing semicolon, mismatch brackets.

Fatal Error – These are basically run time errors which are caused when you try to access what can’t be done. E.g. accessing a dead object, or trying to use a function that hasn’t been declared.

Warning Error – These occurs when u try to include a file that is not present, or delete a file that is not on the server. This will not halt the script; it will give the notice and continue with the next line of the script.

Notice Error – These errors occurs when u try to use a variable that hasn’t been declared, this will not halt the script, It will give the notice and continue with the next line of the script.

Q5: What is session and why do we use it?
A5: Session is a super global variable that preserve data across subsequent pages. Session uniquely defines each user with a session ID, so it helps making customized web application where user tracking is needed.

Q6: What is cookie and why do we use it?
A6: Cookie is a small piece of information stored in client browser. It is a technique used to identify a user using the information stored in their browser (if already visited that website). Using PHP we can both set and get COOKIE.

How to print current date and time.

<?php echo date(‘Y-m-d H:i:s’); ?>

2

3

<?php echo date(‘Y-m-d H:i:s’); ?>

Q7: What function do we use to find length of string, and length of array?
A7: For finding length of string we use strlen() function and for array we use count() function.

Q8: How can we change the value of a constant?
A8: We cannot change the value of a constant.

Q9: How do we get the current session ID?
A9: <?php

session_start();

echo session_id();

?>

2

3

4

5

6

<?php

session_start();

echo session_id();

?>

Q10: What is the difference between explode() and split() functions?
A10: Both are used to split a string to array, the basic difference is that split() uses pattern for splitting and explode() uses a string. explode() is faster than split() as it does not match the string based on regular expression.  Also split() is deprecated as of 5.3.0. So using of this function is discouraged.

Q11: What is an associative array?
A11: Associative arrays are arrays that use named keys that you assign to them.

<?php

$capitals=array(“India”=>”New Delhi”,”China”=>”Beijing”,”Pakistan”=>”Islamabad”);

?>

2

3

4

5

<?php

$capitals=array(“India”=>”New Delhi”,”China”=>”Beijing”,”Pakistan”=>”Islamabad”);

?>

Q12: What is PDO classes?
A12: The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP. It is a data-access abstraction layer, so no matter what database we use the function to issue queries and fetch data will be same. Using PDO drivers we can connect to database like DB2, Oracle, PostgreSQL etc.

Q13: What is the difference between javascript and PHP?
A13: Javascript is a client side scripting language whereas PHP is a server side scripting language.

Q14: What is CSS?
A14: CSS or cascading Style Sheet is a way to style and present HTML.

Q15: What is the difference between ID and class in CSS?
A15: The difference between an ID and Class is that an ID can be used to identify one element, whereas a class can be used to identify more than one.

Q16: How can we submit a form without using submit buttons?
A16: We can use javascript submit function. We can either use form name or form id to print

document.getElementById(“formID”).submit();

document.formname.submit();

2

3

4

document.getElementById(“formID”).submit();

document.formname.submit();

Q17: Why do we use multipart/form-data in html form?
A17: This is the encoding used to send image or files via form, The data will be split into multiple parts and, one for each files plus one for the text of the form body that may be sent with them.

Q18: What is AJAX?
A18: AJAX (Asynchronous JavaScript and XML) is a technique which allows updating parts of a web page, without reloading the whole page. Data is exchanged asynchronously in small amounts of data with the server.

Q19: What is jQuery?
A19: jQuery is a fast, small, and feature-rich JavaScript library. It is an easy-to-use API which makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler across a multitude of browsers.

Q20: How can we show and hide an element via jquery?
A20: Suppose we want to show and hide elements of a div with id div1.

// show div

$(‘#div1’).show();

// hide div

$(‘#div1’).hide();

2

3

4

5

6

// show div

$(‘#div1’).show();

// hide div

$(‘#div1’).hide();

Q21: How can we add change font size using jquery?
A21: Suppose we want change a font size of and div with id div1 from 12px to 18px.

$(‘#div1’).css(‘font-size’, ’18px’);

2

3

$(‘#div1’).css(‘font-size’, ’18px’);

Q22: What is the difference between sql and Mysql?
A22: SQL or Structured Query Language is a programming language designed for managing data held in a Relational Database Management System. Mysql is a open source, relational database management System.

Q23: Why do we use GROUP BY and ORDER BY function in mysql?
A23: Group By is used for retrieving information about a group of data. It is generally used with some aggregate function like SUM, AVG etc. ORDER BY is used to sort the records using column name. It can sort column in both ascending and descending order.

Q24: What is JOIN in mysql? What are the different types of join?
A24: When we have to fetch records from more than one table we can use JOIN keyword. The process is known as joining the tables. There are various types of join like INNER JOIN, LEFT JOIN, RIGHT JOIN, and OUTER JOIN.

Q25: Why is the basic difference between LEFT JOIN, RIGHT JOIN and INNER JOIN?
A25: INNER Join compares two tables and only returns results where a match exists. Records from the 1st table are duplicated when they match multiple results in the 2nd. INNER joins tend to make result sets smaller, but because records can be duplicated this isn’t guaranteed.

LEFT join means keep all records from the 1st table no matter what and insert NULL values when the 2nd table doesn’t match.

RIGHT Join means the opposite: keep all records from the 2nd table no matter what and insert NULL values when the 1st table doesn’t match.

Q26: If we use SUM function in mysql, does it return sum of that row or for that column?
A26: Sum function works on the column basis and will return the sum of that particular row only.

Q27: What do we use to remove duplicate records while fetching a data in mysql ?
A27: We use DISTINCT keyword.

Q28: What is the use of count function in mysql?
A28: count() is used for fetching the total number records in a table.

Q29: How do we use % when performing a search query?
A29: Suppose take an example where you need to fetch all customer data where name stats with sa

SELECT * FROM Customers WHERE name LIKE ‘sa%’;

Another case is where you need to fetch all customer data where kumar is found irrespective of the position (middle name or last name).

SELECT * FROM Customers WHERE name LIKE ‘%kumar%’;

Q30: How do we delete a row in a table?
A30: Take an example

DELETE FROM customer WHERE cid=150;

In this case it will delete the record of the customer with customer id 150

PHP Conclusion Interview FAQs

We know the list of PHP Interview Questions and Answers, PHP Interview Questions and Answers Freshers, PHP Interview Questions and Answers, PHP Interview Questions is overwhelming but the advantages of reading all the questions will maximize your potential and help you crack the interview. The surprising fact is that this PHP interview questions and answers post covers all the basic of the PHP technology and you have to check out the FAQs of different components of PHP too.

However, you will be asked with the questions in the interview related to the above mentioned questions. Preparing and understanding all the concept of PHP technology will help you strengthen the other little information around the topic.

After preparing these interview questions, we recommend you to go for a mock interview before facing the real one. You can take the help of your friend or a PHP expert to find the loop holes in your skills and knowledge. Moreover, this will also allow you in practicing and improving the communication skill which plays a vital role in getting placed and grabbing high salaries.

Remember, in the interview, the company or the business or you can say the examiner often checks your basic knowledge of the subject. If your basics is covered and strengthened, you can have the job of your dream. The industry experts understand that if the foundation of the student is already made up, it is easy for the company to educate the employ towards advance skills. If there are no basics, there is no meaning of having learnt the subject.

Therefore, it’s never too late to edge all the basics of any technology. If you think that you’ve not acquired the enough skills, you can join our upcoming batch of PHP Training in Noida. We are one of the best institute for PHP in noida which provide advance learning in the field of PHP Course. We’ve highly qualified professionals working with us and promise top quality education to the students.

We hope that you enjoyed reading PHP Interview Questions and Answers, PHP Interview Questions and Answers Freshers, PHP Interview Questions and Answers, PHP Interview Questions and all the FAQs associated with the interview. Do not forget to revise all the PHP interview questions and answers before going for the PHP interview. In addition to this, if you’ve any doubt or query associated with PHP, you can contact us anytime. We will be happy to help you out at our earliest convenience. At last, we wish you all the best for your upcoming interview on PHP Technology.