PHP Questions

PHP questions suitable for use in interviews or just for fun.

PHP Question: Post Variables
Question Take the following HTML form.
philipnorton42 Fri, 07/29/2011 - 17:10
PHP Question: While And Do While Looping


What does the $count variable equal after each of these loops?

philipnorton42 Mon, 05/16/2011 - 22:09
PHP Question: Defining Constants


What does the following code do?


define("MY_CONSTANT", array(1,2,3,4,5));
philipnorton42 Mon, 05/09/2011 - 08:59
PHP Question: Class Methods


What is the difference between these two lines of code and can you produce the background code used for them?

philipnorton42 Wed, 05/04/2011 - 21:19
PHP Question: Print Object


The following code was executed.

philipnorton42 Thu, 04/28/2011 - 11:29

PHP Question: Form Variables

22nd April 2011


Given the following form:


How would you get hold of the value of the input box after the form is submitted?

PHP Question: Pass By Reference

19th April 2011


Consider the following:

  1. function doSomething(&$val) {
  2. $val++;
  3. }
  5. $a = 1;
  6. doSomething($a);

What does the variable $a now equal?