nerdexam
Zend

200-550 · Question #19

Which line of code can be used to replace the INSERT comment in order to output "hello"? class C { public $ello = 'ello'; public $c; public $m; function __construct($y) { $this->c = static…

The correct answer is B. return $f() . "ello". See the full explanation below for the reasoning.

Question

Which line of code can be used to replace the INSERT comment in order to output "hello"? class C { public $ello = 'ello'; public $c; public $m; function __construct($y) { $this->c = static function($f) { // INSERT LINE OF CODE HERE }; $this->m = function() { return "h"; }; } } $x = new C("h"); $f = $x->c; echo $f($x->m);

Options

  • Areturn $this->m() . "ello";
  • Breturn $f() . "ello";
  • Creturn "h". $this->ello;
  • Dreturn $y . "ello";

How the community answered

(36 responses)
  • A
    14% (5)
  • B
    75% (27)
  • C
    6% (2)
  • D
    6% (2)

Community Discussion

No community discussion yet for this question.

Full 200-550 Practice