nerdexam
Zend

200-550 · Question #20

What is the output of the following code? function z($x) { return function ($y) use ($x) { return str_repeat($y, $x); }; } $a = z(2); $b = z(3); echo $a(3) . $b(2);

The correct answer is B. 33222. See the full explanation below for the reasoning.

Question

What is the output of the following code? function z($x) { return function ($y) use ($x) { return str_repeat($y, $x); }; } $a = z(2); $b = z(3); echo $a(3) . $b(2);

Options

  • A22333
  • B33222
  • C33322
  • D222333

How the community answered

(41 responses)
  • A
    5% (2)
  • B
    78% (32)
  • C
    5% (2)
  • D
    12% (5)

Community Discussion

No community discussion yet for this question.

Full 200-550 Practice