PrepAway - Latest Free Exam Questions & Answers

What is the output of the following code?

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’);

PrepAway - Latest Free Exam Questions & Answers

A.
A,

B.
A,A,

C.
A,A,A,

D.
PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback

2 Comments on “What is the output of the following code?

  1. Ilya says:

    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’);




    2



    0

Leave a Reply

Your email address will not be published. Required fields are marked *