nerdexam
Zend

200-710 · Question #5

What is the output of the following code? class Test { public $var = 1; } function addMe (Test $t) { $t->var++; } $t = new Test(); addMe($t); echo $t->var;

The correct answer is A. 1. See the full explanation below for the reasoning.

Object-Oriented Programming

Question

What is the output of the following code? class Test { public $var = 1; } function addMe (Test $t) { $t->var++; } $t = new Test(); addMe($t); echo $t->var;

Options

  • A1
  • B2
  • Cnull

How the community answered

(37 responses)
  • A
    73% (27)
  • B
    8% (3)
  • C
    19% (7)

Topics

#object passing#pass by handle#class properties#method parameters

Community Discussion

No community discussion yet for this question.

Full 200-710 Practice