nerdexam
Zend

200-550 · Question #64

What will the $array array contain at the end of this script? function modifyArray (&$array) { foreach ($array as &$value) { $value = $value + 1; } $value = $value + 2; } $array = array (1, 2, 3)…

The correct answer is B. 2, 3, 6. See the full explanation below for the reasoning.

Question

What will the $array array contain at the end of this script? function modifyArray (&$array) { foreach ($array as &$value) { $value = $value + 1; } $value = $value + 2; } $array = array (1, 2, 3); modifyArray($array);

Options

  • A2, 3, 4
  • B2, 3, 6
  • C4, 5, 6
  • D1, 2, 3

How the community answered

(29 responses)
  • A
    3% (1)
  • B
    83% (24)
  • C
    3% (1)
  • D
    10% (3)

Community Discussion

No community discussion yet for this question.

Full 200-550 Practice