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)- A73% (27)
- B8% (3)
- C19% (7)
Topics
#object passing#pass by handle#class properties#method parameters
Community Discussion
No community discussion yet for this question.