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

Question

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

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

Question

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

Question

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

Question

The following code was executed.

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

PHP Question: Form Variables

22nd April 2011

Question

Given the following form:

  1.  

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

Question

Consider the following:

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

What does the variable $a now equal?