1. Do you know who is the father of PHP?

Rasmus Lerdorf is known as the father of PHP.

3. Tell me what is use of header() function in php?

The header() function sends a raw HTTP header to a client.We can use herder() function for redirection of pages. It is important to notice that header() must be called before any actual output is seen.

4. Tell us what does a special set of tags <?= and ?> do in PHP?

The output is displayed directly to the browser.

6. Tell me how to run the interactive PHP shell from the command line interface?

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

php -a

7. Tell me is it possible to destroy a cookie?

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

8. Explain me what is the difference between for and foreach?

for is expressed as follows:

for (expr1; expr2; expr3)

statement

The first expression is executed once at the beginning. In each iteration, expr2 is evaluated. If it is TRUE, the loop continues and the statements inside for are executed. If it evaluates to FALSE, the execution of the loop ends. expr3 is tested at the end of each iteration.

However, foreach provides an easy way to iterate over arrays and it is only used with arrays and objects.

9. Tell me what is the differences between $a != $b and $a !== $b?

!= means inequality (TRUE if $a is not equal to $b) and !== means non-identity (TRUE if $a is not identical to $b).

10. Tell me what does $_SERVER means?

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

Download Interview PDF

11. Explain me what is the difference between $name and $$name?

$name is variable where as $$name is reference variable like $name=sonia and $$name=singh so $sonia value is singh.

12. Tell me how to store the uploaded file to the final location?

move_uploaded_file( string filename, string destination)

13. Do you know how to define a constant?

Constants in PHP are defined using define() directive, like define("MYCONSTANT", 100);

14. Tell us what does the initials of PHP stand for?

PHP means PHP: Hypertext Preprocessor.

15. How can we display the output directly to the browser?

To be able to display the output directly to the browser, we have to use the special tags <?= and ?>.

16. Tell us is it possible to protect special characters in a query string?

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

17. Do you know what does the expression Exception::__toString means?

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

18. Please explain what does $_COOKIE means?

$_COOKIE is an associative array of variables sent to the current PHP script using the HTTP Cookies.

19. Do you know what does $_FILES means?

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

20. Tell us how can we determine whether a variable is set?

The boolean function isset determines if a variable is set and is not NULL.

21. Do you know what is the default session time in php?

The default session time in php is until closing of browser

22. What is the actually used PHP version?

Version 7 is the actually used version of PHP.

23. Do you know how to get the value of current session id?

session_id() returns the session id for the current session.

24. Tell me what are default session time and path?

default session time in PHP is 1440 seconds or 24 minutes
Default session save path id temporary folder /tmp

Download Interview PDF