PHP developers are the one who develop various applications, programs, and some websites even making use of different scripting languages like PHP. If you are the one who has already done PHP, then below listed are some interview questions for freshers. These questions will surely help you in your interviews:
Question 1: What types of loops are there in PHP?
There are 4 types of loops in PHP: for, while, do while, and foreach.
Question2: How can you display the output to the browser?
In order to display the output to browser, you can use special tags:- <?= and ?>
Question 3: How can you create MySQL connection in PHP?
mysql_connect(servername, username, password)
Question 4: Difference between unset and unlink in PHP programming language?
Unset defines a variable into something ‘undefined’ whereas on the other hand, unlink permanently deletes a file that we pass from the system of files.
Question 5: Tell the main types of errors in PHP?
There are three main types of errors in PHP which are:
- Notice error: These are simple errors which occur while the execution of script. For eg: you are getting access to an undefined variable and you get a notice error.
- Warning error: This type of error is more important than that of a notice error.In this type of error, the script continues the execution process and the error pop up.
- Fatal error: This error type causes termination in the script execution process.
Question 6: What do you mean by Traits?
Traits are a type of mechanism which give you access to create reusable codes in PHP where the language does not support multiple inheritance. Trait is one of the powerful feature which any developer should keep in mind.
Question 7: What do you mean by PEAR?
PEAR is known as PHP extension and Application Repository. It is a system of distribution and framework for reusing the components of PHP. It offers you a high level of programming and extends PHP for all the web developers out there. PEAR has three different parts: PEAR packages, PEAR core component, PECL packages.
Question 8: Why do you use ksort in PHP?
We use ksort in PHP to sort any array developed by key in a reverse order.
Question 9: Mention the types of data in PHP programming language?
Doubles, Integers, Booleans, Objects, null, Strings, Arrays.
Question 10: What do you mean by a numeric array?
Numeric array is an array which has numeric index. These values are stored and can be easily accessed in a linear pattern.
Question 11: Explain the use of count function in MYSQL?
This function is used to fetch the total records in any table.
Question 12: Which page is a default page in a web server?
Index page is the default page in a web server.
Question 13: Why do you use cookie and what is it?
A cookie is a piece of information which is stored in the browser. This is a technique through which we can identify the user using the information from the browser.
Question 14: Can we modify the value of a constant?
No, we cannot modify the value of a constant.
Question 15: What do you mean by AJAX?
Question 16: What do you mean by jQuery?
Question 17: Difference between MySQL and SQL?
SQL also known as structured query language is a known programming language which is made to manage data that is stored in Relational Database Management System whereas mysql on the other hand is an open source database management system.
Question 18: Why do you use print in PHP?
Print is not a function of printing in php but is a language construct.
Above listed 18 questions are the best when it comes to interview preparations. If you are already a PHP developer and are planning for interviews, then go ahead and start preparing for the questions listed above. If you are planning to learn PHP language, then we, at Keystudioz Technologies have got you the right solution. Get yourself enrolled at the best PHP development institute in Noida.