Monday, November 23, 2009

The following code block produces which output array?

$a = array(1 => "A", "B", "C");
$a[1] = "A"; $a[] = "B"; $a[] = "C";

print_r($a);

a) A => 1, B => 2, C => 3, B => 4, C => 5
b) A => 1, B => 2, C => 3
c) 1 => A, 2 => B, 3 => C
d) 0 => A, 1 => B, 2 => C
e) 1 => A, 2 => B, 3 => C, 4 => B, 5 => C

References :

PHP Arrays

Comments to answer

1 comments:

  1. option (e) seems to be the right choice.

    ReplyDelete