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
Authenticity9
creatorAnirudh(39271)

Back to Parent Category
Create QuestionPDF  
.
Question: What does $GLOBALS means?

Answer:$GLOBALS is associative array including references to all variables which are currently defined in the global scope of the script.


Question: What does $_SERVER means?

Answer:$_SERVER is an array including information created by the web server such as paths, headers, and script locations.


Question: What does $_FILES means?

Answer:$_FILES is an associative array composed of items sent to the current script via the HTTP POST method.


Question: What is the difference between $_FILES['userfile']['name'] and $_FILES['userfile']['tmp_name']?

Answer:$_FILES['userfile']['name'] represents the original name of the file on the client machine,

$_FILES['userfile']['tmp_name'] represents the temporary filename of the file stored on the server.


Question: How can we change the maximum size of the files to be uploaded?

Answer:We can change the maximum size of files to be uploaded by changing upload_max_filesize in php.ini.


Question: What does $_ENV means?

Answer:$_ENV is an associative array of variables sent to the current PHP script via the environment method.


Question: How can we determine whether a PHP variable is an instantiated object of a certain class?

Answer:To be able to verify whether a PHP variable is an instantiated object of a certain class we use instanceof.


Question: what is the difference between Exception::getMessage and Exception::getLine ?

Answer:Exception::getMessage lets us getting the Exception message and Exception::getLine lets us getting the line in which the exception occurred.


Question: What does the expression Exception::__toString means?

Answer:Exception::__toString gives the String representation of the exception.


Question: How is it possible to parse a configuration file?

Answer:The function parse_ini_file() enables us to load in the ini file specified in filename, and returns the settings in it in an associative array.


Question: What is the difference between the functions strstr() and stristr()?

Answer:The string function strstr(string allString, string occ) returns part of allString from the first occurrence of occ to the end of allString. This function is case-sensitive. stristr() is identical to strstr() except that it is case insensitive.


Question: What is the difference between ereg_replace() and eregi_replace()?

Answer:The function eregi_replace() is identical to the function ereg_replace() except that it ignores case distinction when matching alphabetic characters.


Question: Is it possible to protect special characters in a query string?

Answer:Yes, we use the urlencode() function to be able to protect special characters.


Question: What are the three classes of errors that can occur in PHP?

Answer:The three basic classes of errors are notices (non-critical), warnings (serious errors) and fatal errors (critical errors).


Question: Is it possible to destroy a cookie?

Answer:Yes, it is possible by setting the cookie with a past expiration time.


Question: What is the default session time in php?

Answer:The default session time in php is until closing of browser


Question: Is it possible to use COM component in PHP?

Answer:Yes, it’s possible to integrate (Distributed) Component Object Model components ((D)COM) in PHP scripts which is provided as a framework.


Question: Echo vs. print statement.

Answer:echo() and print() are language constructs in PHP, both are used to output strings. The speed of both statements is almost the same.

echo() can take multiple expressions whereas print cannot take multiple expressions.

Print return true or false based on success or failure whereas echo doesn't return true or false.


Question: Explain the importance of the function htmlentities.

Answer:The htmlentities() function converts characters to HTML entities.


Question: What is MIME?

Answer:MIME - Multi-purpose Internet Mail Extensions.

MIME types represents a standard way of classifying file types over Internet.

Web servers and browsers have a list of MIME types, which facilitates files transfer of the same type in the same way, irrespective of operating system they are working in.

A MIME type has two parts: a type and a subtype. They are separated by a slash (/).

MIME type for Microsoft Word files is application and the subtype is msword, i.e. application/msword.