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


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.

Back to Parent Category
Create QuestionPDF  
Question: How can we check the value of a given variable is a number?

Answer:It is possible to use the dedicated function, is_numeric() to check whether it is a number or not.

Question: How can we check the value of a given variable is alphanumeric?

Answer:It is possible to use the dedicated function, ctype_alnum to check whether it is an alphanumeric value or not.

Question: How do I check if a given variable is empty?

Answer:If we want to check whether a variable has a value or not, it is possible to use the empty() function.

Question: What does the unset() function means?

Answer:The unset() function is dedicated for variable management. It will make a variable undefined.

Question: What does the unlink() function means?

Answer:The unlink() function deletes a file.

This function returns TRUE on success, or FALSE on failure.

Question: How do I escape data before storing it into the database?

Answer:addslashes function enables us to escape data before storage into the database.

Question: How can we automatically escape incoming data?

Answer:We have to enable the Magic quotes entry in the configuration file of PHP.

Question: What does the function get_magic_quotes_gpc() means?

Answer:The function get_magic_quotes_gpc() tells us whether the magic quotes is switched on or no.

Question: Is it possible to remove the HTML tags from data?

Answer:The strip_tags() function enables us to clean a string from the HTML tags.

Question: How a constant is defined in a PHP script?

Answer:The define() directive lets us defining a constant as follows:

define (“ACONSTANT”, 123);

Question: How can you pass a variable by reference?

Answer:To be able to pass a variable by reference, we use an ampersand in front of it, as follows $var1 = &$var2

Question: How is it possible to cast types in PHP?

Answer:The name of the output type have to be specified in parentheses before the variable which is to be cast as follows:

* (int), (integer) – cast to integer

* (bool), (boolean) – cast to boolean

* (float), (double), (real) – cast to float

* (string) – cast to string

* (array) – cast to array

* (object) – cast to object

Question: How is the ternary conditional operator used in PHP?

Answer:It is composed of three expressions: a condition, and two operands describing what instruction should be performed when the specified condition is true or false as follows:

Expression_1 ? Expression_2 : Expression_3;

Question: What is the function func_num_args() used for?

Answer:The function func_num_args() is used to give the number of parameters passed into a function.

Question: What does accessing a class via :: means?

Answer::: is used to access static methods that do not require object initialization.

Question: In PHP, objects are they passed by value or by reference?

Answer:In PHP, objects passed by value.

Question: Are Parent constructors called implicitly inside a class constructor?

Answer:No, a parent constructor have to be called explicitly as follows:


Question: What’s the difference between __sleep and __wakeup?

Answer:__sleep returns the array of all the variables that need to be saved, while __wakeup retrieves them.

Question: What is the meaning of a Persistent Cookie?

Answer:A persistent cookie is permanently stored in a cookie file on the browser’s computer. By default, cookies are temporary and are erased if we close the browser.

Question: What is the difference between session_unregister() and session_unset()?

Answer:The session_unregister() function unregister a global variable from the current session and the session_unset() function free all session variables.