MCQs > IT & Programming > PHP 5 > class First { private $foo = 2; protected $bar = 4; protected function A_funct() { return 5; } public function B_funct() { return new class($this->foo) extends First { private $test; public function _construct($foo) { $this->test = $foo; } public function C_funct() { return $this->bar + $this->test + $this->A_funct(); } }; } } echo (new First)->B_funct()->C_funct();?>

PHP 5 MCQs

What will be the output of the following PHP 7.1 code?

class First

{

private $foo = 2;

protected $bar = 4;

protected function A_funct()

{

return 5;

}

public function B_funct()

{

return new class($this->foo) extends First {

private $test;

public function _construct($foo)

{

$this->test = $foo;

}

public function C_funct()

{

return $this->bar + $this->test + $this->A_funct();

}

};

}

}

echo (new First)->B_funct()->C_funct();?>


Answer

Correct Answer:

11

Explanation:

Note: This Question is unanswered, help us to find answer for this one

PHP 5 Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

PHP 5 Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it