Zend
200-710 · Question #41
What is the output of the following code? class Test { public function __call($name, $args) { call_user_func_array('static::' . $name . '__testName', $args); echo "$1, "; } public static function…
The correct answer is B. A,A. See the full explanation below for the reasoning.
Magic Methods and Traits
Question
What is the output of the following code?
class Test {
public function __call($name, $args) {
call_user_func_array('static::' . $name . '__testName', $args);
echo "$1, ";
}
public static function testS($1) {
echo "$1, ";
}
}
class Test2 extends Test {
public static function testS($1) {
echo "$1, ";
}
}
$test = new Test2();
$test->S('A');
Options
- AA, A,,
- BA,A,,
- CA,A,A,,
- DPHP Warning: call_user_func_array() expects parameter 1 to be a valid callback
How the community answered
(58 responses)- A16% (9)
- B76% (44)
- C7% (4)
- D2% (1)
Topics
#__call#call_user_func_array#static methods#inheritance
Community Discussion
No community discussion yet for this question.