nerdexam
Zend

200-550 · Question #28

What is the output of the following code? class Test { public function __call($name, $args) { call_user_func_array(array('static', "test$name"), $args); } public function testS($l) { echo "$l,"; } }…

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

Question

What is the output of the following code? class Test { public function __call($name, $args) { call_user_func_array(array('static', "test$name"), $args); } public function testS($l) { echo "$l,"; } } class Test2 extends Test { public function testS($l) { echo "$l,$l,"; } } $test = new Test2(); $test->S('A');

Options

  • AA,
  • BA,A,
  • CA,A,A,
  • DPHP Warning: call_user_func_array() expects parameter 1 to be a valid callback

How the community answered

(32 responses)
  • A
    3% (1)
  • B
    84% (27)
  • C
    9% (3)
  • D
    3% (1)

Community Discussion

No community discussion yet for this question.

Full 200-550 Practice