PHP Questions

As part of a new series of posts I will be creating a set of PHP questions suitable for use in interviews or just for fun. They will range from the very easy to very difficult but are all designed to test one or two specific parts of the PHP language. The idea is not to test for knowledge of the order of PHP function parameters (which I often have to look up), but more to test if the candidate knows how the language works. It is also quite a good mechanism to post about some of the fundamentals of the PHP language.

The basic format of the question posts will be the question at the top, followed by a bit of white space before the the answer. Having this white space is so that you can have a little think about the question before being dropped into the answer, but also avoids having to open any hidden areas or anything like that. The answer to the question won't just state what is correct, but also why it is correct and also any points that you should be thinking about in addition to the information given. Each section will have headings to show which is bit is which.

Feel free to take these questions and use them in your own interviews.

I have created a new category to store these questions in and will be updating this post as and when I add more questions to that category.

The Questions

  1. Scope Resolution
  2. Printing A Boolean Value
  3. Increment By One
  4. Include And Require Files
  5. Octal Values
  6. Variable Reference
  7. Pass By Reference
  8. Form Variables
  9. Object Property Increment
  10. Print Object
  11. PHP Script Shape
  12. Class Methods
  13. Defining Constants
  14. While And Do While Looping

Comments

Enjoying this series Phil, very interesting.

Permalink

Glad to hear it Pete! I have to admit that I have learnt one or two things whilst I was writing the answers. :)

Name
Philip Norton
Permalink

Add new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
8 + 2 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.