nerdexam
Zend

200-710 · Question #109

200-710 Question #109: Real Exam Question with Answer & Explanation

The correct answer is B. 6. See the full explanation below for the reasoning.

Question

What is the output of the following code?
class A {
 public $a = 1;
 public function __construct($a) { $this->a = $a; }
 public function mul() {
 return function ($x) {
 return $this->a*$x;
 };
 }
}
$a = new A(2);
$a_mul = $a->mul();
$m = $a->mul();
echo $m(3);

Options

  • A9
  • B6
  • C0
  • D3

Community Discussion

No community discussion yet for this question.

Full 200-710 Practice