PHP Interview Questions - Image


PHP stands for Hypertext Preprocessor and it is a general-purpose programming language originally designed for web development. It is an interpreted language i.e there is no need for compilation. It’s a server-side scripting language. One of the key points is PHP is faster than other scripting languages, for examples, ASP and JSP.

What distinguishes PHP from something like client-side javascript is that the code is executed on the server, generating HTML which is then sent to the client. the client would receive the results of running that script, but would not know what the underlying code was. you can even configure your web server to process all your HTML file with php, and then there’s really no way that users can tell what you have up your sleeve. Although PHP’s development is focused on server-side scripting you can do much more with it.

The best things in using PHP are that it is extremely simple for a newcomer, but offers many advanced features for a professional programmer. 

PHP Interview Questions – 120 Questions

  1. What is PHP?
  2. What do the initials of PHP stand for?
  3. Which programming language does PHP resemble?
  4. What does PEAR stand for?
  5. What is the actually used PHP version?
  6. How do you execute a PHP script from the command line?
  7. How to run the interactive PHP shell from the command line interface?
  8. What is the correct and the most two common way to start and finish a PHP block of code?
  9. How can we display the output directly to the browser?
  10. What is the main difference between PHP 4 and PHP 5?
  11. Is multiple inheritance supported in PHP?
  12. What is the meaning of a final class and a final method?
  13. How is the comparison of objects done in PHP?
  14. How can PHP and HTML interact?
  15. What type of operation is needed when passing values through a form or an URL?
  16. How can PHP and Javascript interact?
  17. What is needed to be able to use the image function?
  18. What is the use of the function ‘imagetypes()’?
  19. What are the functions to be used to get the image’s properties (size, width, and height)?
  20. How failures in execution are handled with include() and require() functions?
  21. What is the main difference between require() and require_once()?
  22. How can I display text with a PHP script?
  23. How can we display information of a variable and readable by a human with PHP?
  24. How is it possible to set an infinite execution time for PHP script?
  25. What does the PHP error ‘Parse error in PHP – unexpected T_variable at line x’ means?
  26. What should we do to be able to export data into an Excel file?
  27. What is the function file_get_contents() useful for?
  28. How can we connect to a MySQL database from a PHP script?
  29. What is the function mysql_pconnect() useful for?
  30. How be the result set of Mysql handled in PHP?
  31. How is it possible to know the number of rows returned in the result set?
  32. Which function gives us the number of affected entries by a query?
  33. What is the difference between mysqli_fetch_object() and mysqli_fetch_array()?
  34. How can we access the data sent through the URL with the GET method?
  35. How can we access the data sent through the URL with the POST method?
  36. How can we check the value of a given variable is a number?
  37. How can we check the value of a given variable is alphanumeric?
  38. How do I check if a given variable is empty?
  39. What does the unlink() function mean?
  40. What does the unset() function mean?
  41. How do I escape data before storing it in the database?
  42. How is it possible to remove escape characters from a string?
  43. How can we automatically escape incoming data?
  44. What does the function get_magic_quotes_gpc() means?
  45. Is it possible to remove the HTML tags from data?
  46. what is the static variable in function useful for?
  47. How can we define a variable accessible in functions of a PHP script?
  48. How is it possible to return a value from a function?
  49. What is the most convenient hashing method to be used to hash passwords?
  50. Which cryptographic extension provide generation and verification of digital signatures?
  51. How is a constant defined in a php script?
  52. How can you pass a variable by reference?
  53. How is it possible to cast types in PHP?
  54. When is a conditional statement ended with endif?
  55. How is the ternary conditional operator used in php?
  56. What is the function func_num_args() used for?
  57. What does accessing a class via :: means?
  58. In PHP, objects are they passed by value or by reference?
  59. Are Parent constructors called implicitly inside a class constructor?
  60. What’s the difference between __sleep and __wakeup?
  61. What is faster?
  62. what is the definition of a session?
  63. How to initiate a session in PHP?
  64. How can you propagate a session id?
  65. What is the meaning of a Persistent Cookie?
  66. When do sessions end?
  67. What is the difference between session_unregister() and session_unset()?
  68. What does $GLOBALS mean?
  69. What does $_SERVER mean?
  70. What does $_FILES means?
  71. What is the difference between $_FILES[‘userfile’][‘name’] and $_FILES[‘userfile’][‘tmp_name’]?
  72. How can we get the error when there is a problem to upload a file?
  73. How can we change the maximum size of the files to be uploaded?
  74. What does $_ENV mean?
  75. What does $_COOKIE mean?
  76. What does the scope of variables mean?
  77. what the difference between the ‘BITWISE AND’ operator and the ‘LOGICAL AND’ operator?
  78. What are the two main string operators?
  79. What does the array operator ‘===’ means?
  80. What is the differences between $a != $b and $a !== $b?
  81. How can we determine whether a php variable is an instantiated object of a certain class?
  82. What is the goto statement useful for?
  83. what is the difference between Exception::getMessage and Exception:: getLine?
  84. What does the expression Exception::__toString means?
  85. How is it possible to parse a configuration file?
  86. How can we determine whether a variable is set?
  87. What is the difference between the functions strstr() and stristr()?
  88. what is the difference between for and foreach?
  89. Is it possible to submit a form with a dedicated button?
  90. What is the difference between ereg_replace() and eregi_replace()?
  91. Is it possible to protect special characters in a query string?
  92. What are the three classes of errors that can occur in PHP?
  93. How can we pass the variable through the navigation between the pages?
  94. Is it possible to extend the execution time of a php script?
  95. Is it possible to destroy a cookie?
  96. What is the default session time in PHP?
  97. Is it possible to use COM component in PHP?
  98. Explain whether it is possible to share a single instance of a Memcache between multiple php projects?
  99. Explain how you can update Memcached when you make changes to PHP?
  100. What’s the difference between the include() and require() functions?
  101. How can we get the IP address of the client?
  102. What’s the difference between unset() and unlink()
  103. What are the main error types in PHP and how do they differ?
  104. What is the difference between GET and POST?
  105. How can you enable error reporting in php?
  106. What are Traits?
  107. Can the value of a constant change during the script’s execution?
  108. Can you extend a Final defined class?
  109. What are the __construct() and __destruct() methods in a php class?
  110. How we can get the number of elements in an array?
  111. What are the 3 scope levels available in php and how would you define them?
  112. What are getters and setters and why are they important?
  113. What does MVC stand for and what does each component do?
  114. How does one prevent the following Warning ‘Warning: Cannot modify header information – headers already sent’ and why does it occur in the first place?
  115. What are SQL Injections, how do you prevent them and what are the best practices?
  116. Why would you use === instead of ==?
  117. Describe the Use of “ksort” in PHP
  118. What are PSRs? Choose 1 and briefly describe it.
  119. What PSR Standards do you follow? Why would you follow a PSR standard?
  120. How Is a Session Created? How Is a Value Set in Session? How Do You Remove Data From a Session?

Related Interview Questions and Answer

Top 101 MongoDB Interview Questions 2019

MongoDB  MongoDB is an open source document database4 and leading NoSQL database. It's a powerful, FREE & highly scalable NoSQL database. Its very popular choice of a highly scalable database and currently being used as the backend data store of many well-known...

Ultimate 200 Python Interview Questions 2019 | Mockrabbit

Python Interview Question Python Programming can be easy to pick up whether you're a first-time programmer or you have experienced in other languages. It is one of the most widely used programming languages. Despite being slow python is very popular,...

Top 300 Behavioral Interview Questions Asked in Interview

Why Behavioral Interview Questions Every business sets its operating rules and directives aligned with their vision, mission, purpose, and objectives. During the interview, it is the responsibility of a hiring manager to find candidates whose values, attitude, skills,...

Top 300 IOS Interview Questions 2019 | Mockrabbit

300 IOS Interview Questions Interviews become unnerving at times. But, in spite of whatever one thinks about it, you still have to go through it in order to get the job to leverage your geniuses and earn the income to fulfil your life goals. These 300 IOS...

Top 100 Android Interview Questions – 2019

Top 100 Android Interview Questions  Interviews become unnerving at times. But, in spite of whatever one thinks about it, you still have to go through it in order to get the job to leverage your geniuses and earn the income to fulfil your life goals. This...

Top 50 Java Interview Questions – 2019

 Dreaming about a career in IT? But let's be clear in our mind, to have a fantastic career in IT, the hands-on experience and expertise in Java Programming Language is the most essential requirement. Now, you must be wondering that “Why should I learn Java Programming...

Top 10 Most Common Interview Questions People Failed to Answer

Sometimes we prepare in and out about our subjects so much that we forgot to get our hands on some basic yet important behavioural questions and this is where interviewer caught us off guard. Most of us don't even know how to cope up with such catch 22 situation....

Top 50 SQL Interview Questions Asked in Interview – 2019

We live in a period where data is the most important resource and it's being put on a fundamental level of each basic leadership process. SQL powers the most commonly used database engines like MySQL, SQL Server, SQLite, and PostgreSQL: Source: StackOverflow Developer...

Knowledge is of no value unless you put it into practice.