get the app get the app       get the app       get the app

PHP Interview QUESTIONS

Exam NamePHP Interview QUESTIONS
DescriptionPHP Interview QUESTIONS contains the questions from various interview of IT industry.These questions are helpful to crack the IT interview.
Exam TypeMASTER EXAM
Authenticity6
creatorAnirudh(39045)
Create QuestionPDF  

Back to Parent Category
Question: What is PHP?

Answer:PHP is a web language based on scripts that allows developers to dynamically create generated web pages.


Question: What does the initials of PHP stand for?

Answer:PHP means PHP: Hypertext Preprocessor.


Question: What does PEAR stands for?

Answer:PEAR means “PHP Extension and Application Repository”. it extends PHP and provides a higher level of programming for web developers.


Question: How do you execute a PHP script from the command line?

Answer:Just use the PHP command line interface (CLI) and specify the file name of the script to be executed as follows:
php script.php


Question: How to run the interactive PHP shell from the command line interface?

Answer:Just use the PHP CLI program with the option -a as follows:
php -a


Question: What is the main difference between PHP 4 and PHP 5?

Answer:PHP 5 presents many additional OOP (Object Oriented Programming) features.


Question: Is multiple inheritance supported in PHP?

Answer:PHP includes only single inheritance, it means that a class can be extended from only one single class using the keyword ‘extended’.


Question: What is the meaning of a final class and a final method?

Answer:final’ is introduced in PHP5. Final class means that this class cannot be extended and a final method cannot be overrided.


Question: How comparison of objects is done in PHP5?

Answer:We use the operator ‘==’ to test is two object are instanced from the same class and have same attributes and equal values. We can test if two object are refering to the same instance of the same class by the use of the identity operator ‘===’.


Question: What type of operation is needed when passing values through a form or an URL?

Answer:If we would like to pass values througn a form or an URL then we need to encode and to decode them using htmlspecialchars() and urlencode().


Question: How can PHP and Javascript interact?

Answer:PHP and Javascript cannot directly interacts since PHP is a server side language and Javascript is a client side language. However we can exchange variables since PHP is able to generate Javascript code to be executed by the browser and it is possible to pass specific variables back to PHP via the URL.


Question: What is needed to be able to use image function?

Answer:GD library is needed to be able execute image functions.


Question: How failures in execution are handled with include() and require() functions?

Answer:If the function require() cannot access to the file then it ends with a fatal error. However, the include() function gives a warning and the PHP script continues to execute.


Question: How is it possible to set an infinite execution time for PHP script?

Answer:The set_time_limit(0) added at the beginning of a script sets to infinite the time of execution to not have the PHP error ‘maximum execution time exceeded’.It is also possible to specify this in the php.ini file.


Question: What is the function file_get_contents() usefull for?

Answer:file_get_contents() lets reading a file and storing it in a string variable.


Question: What is the function mysql_pconnect() usefull for?

Answer:mysql_pconnect() ensure a persistent connection to the database, it means that the connection do not close when the the PHP script ends.


Question: How the result set of Mysql be handled in PHP?

Answer:The result set can be handled using mysql_fetch_array, mysql_fetch_assoc, mysql_fetch_object or mysql_fetch_row.


Question: How is it possible to know the number of rows returned in result set?

Answer:The function mysql_num_rows() returns the number of rows in a result set.


Question: Which function gives us the number of affected entries by a query?

Answer:mysql_affected_rows() return the number of entries affected by an SQL query.


Question: What is the difference between mysql_fetch_object() and mysql_fetch_array()?

Answer:The mysql_fetch_object() function collects the first single matching record where mysql_fetch_array() collects all matching records from the table in an array.