nerdexam
Zend

200-550 · Question #26

What is the output of the following code? class Base { protected static function whoami() { echo "Base "; } public static function whoareyou() { static::whoami(); } } class A extends Base { public…

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

Question

What is the output of the following code? class Base { protected static function whoami() { echo "Base "; } public static function whoareyou() { static::whoami(); } } class A extends Base { public static function test() { Base::whoareyou(); self::whoareyou(); parent::whoareyou();

Options

  • AB B B B B
  • BBase A Base A B
  • CBase B B A B
  • DBase B A A B

How the community answered

(30 responses)
  • A
    13% (4)
  • B
    3% (1)
  • C
    77% (23)
  • D
    7% (2)

Community Discussion

No community discussion yet for this question.

Full 200-550 Practice