PHP Interview Questions

July 31, 2016 by Giryavva Ghodake

Filed under php

Last modified October 20, 2016

PHP Interview Questions

  1. What is PHP database?
  2. What are the common usage of PHP database?
  3. In how many ways you can embed PHP code in an HTML page?
  4. What is the purpose of php.ini file?
  5.  What is escaping to PHP?
  6. What do you mean by having PHP as whitespace insensitive?
  7. Is PHP a case sensitive language?
  8. What are the characteristics of PHP variables?
  9.  What are the different types of PHP variables?
  10.  What are rules for naming a PHP variable?
  11.  What are the rules for determine the “truth” of any value not already of the Boolean type?
  12.  What is NULL?
  13.  How will you define a constant in PHP?
  14.  What is the purpose of constant() function?
  15.  What are the differences between PHP constants and variables?
  16.  What are PHP magic constants?
  17. What is the purpose of _LINE_ constant?
  18.  What is the purpose of _FILE_ constant?
  19.  What is the purpose of _FUNCTION_ constant?
  20.  What is the purpose of _CLASS_ constant?
  21.  What is the purpose of _METHOD_ constant?
  22.  What is the purpose of break statement?
  23.  What is the purpose of continue statement?
  24. Explain the syntax for ‘foreach’ loop. What is numeric array?
  25.  What is associate array?
  26. What is Multidimensional array?
  27. How will you concatenate two strings in PHP database?
  28.  How will you find the length of a string in PHP?
  29.  How will you locate a string within a string in PHP?
  30.  How will you get environment variables in PHP?
  31.  How will you get the browser’s details using PHP?
  32.  How will you generate random numbers using PHP?
  33. What is the purpose $_PHP_SELF variable?
  34.  How will you redirect a page using PHP database?
  35.  How can you display a file download dialog box using PHP?
  36. How will you get information sent via get method in PHP?
  37.  How will you get information sent via post method in PHP?
  38.  What is the purpose $_REQUEST variable?
  39. Which function will you use to create an array?
  40.  How can you sort an array?
  41.  What is the difference between single quoted string and double quoted string?
  42.  How will you concatenate two strings?
  43. What is the use of $_REQUEST variable?
  44. How will you include the content of a PHP file into another PHP file?
  45.  What is the difference between include() Function and require() Function?
  46. How will you open a file in readonly mode?
  47.  How will you read a file in php?
  48. How will you get the size of a file in php?
  49. How will you check if a file exists or not using php?
  50. Can you assign the default values to a function parameters?
  51.  How will you set cookies using PHP database?
  52. How will you get cookies using PHP?
  53.  How will you make a check that a cookie is set or not?
  54. How will you delete a cookie?
  55.  How will you start a session in PHP?
  56.  How will you access session variables in PHP?
  57. How will you check if session variable is already set or not in PHP?
  58. How will you unset a single session variable?
  59.  How will you destroy the session?
  60.  How will you send an email using PHP?
  61.  What is the purpose of $_FILES variable in PHP?
  62.  How will you access the uploaded file in PHP?
  63. How will you access the actual name of the uploaded file in PHP?
  64.  How will you access the size of the uploaded file in PHP database?
  65. How will you access the content type of the uploaded file in PHP?
  66.  How will you access the error code associated with file upload in PHP?
  67. What is the purpose of $GLOBALS variable in PHP?
  68.  What is the purpose of $_SERVER variable in PHP?
  69. What is the purpose of $_COOKIE variable in PHP?
  70.  What is the purpose of $_SESSION variable in PHP?
  71.  What is the purpose of $_PHP_SELF variable in PHP?
  72.  What is the purpose of $php_errormsg variable in PHP?
  73.  How ereg() function works?
  74.  How eregi() function works?
  75.  How split() function works?
  76. How preg_match() function works?
  77.  How preg_split() function works?
  78.  How will you retrieve the error message using Exception class in PHP when error occured?
  79.  How will you retrieve code of exception using Exception class in PHP database when error occured?
  80.  How will you retrieve source filename using Exception class in PHP when error occured?
  81.  How will you retrieve source line using Exception class in PHP when error occured?
  82. How will you retrieve stack trace using Exception class in PHP when error occured?
  83. How will you retrieve formated string of trace in PHP database when error occured?
  84.  How will you get the current date and time using PHP?
  85. What is the purpose of getdate() function?
  86. What is the purpose of date() function?
  87. How will you connect a MySql database using PHP?
  88. How will you create a MySql database using PHP?
  89.  How will you close a MySql database using PHP?
  90.  How will you parse an XML document using PHP?
  91. Can you create a class in PHP?
  92. How will you add a constructor function to a PHP class?
  93.  How will you add a destructor function to a PHP class?
  94.  How will you access the reference to same object within the object in PHP?
  95.  How will you create objects in PHP database?
  96.  How will you call member functions of a class in PHP?
  97.  What is function overriding? What are interfaces n PHP database? What is the use of final keyword?

Leave a Comment