Q. What will be the output?

Code:
class A { public function test() { echo static::class; } }
class B extends A {}
(new B())->test();
  • (A) A
  • (B) B
  • (C) Error
  • (D) NULL
πŸ’¬ Discuss
βœ… Correct Answer: (B) B
Explanation: Late static binding resolves to child class.
Explanation by: Roshan
Late static binding resolves to child class.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
13
Total Visits
πŸ“½οΈ
2 mo ago
Published
πŸŽ–οΈ
Roshan
Publisher
πŸ“ˆ
84%
Success Rate