Zend
200-710 · Question #85
What is the output of the following code? function increment ($val) { $val = $val + 1; } $val = 1; increment ($val); echo $val;
The correct answer is A. 1. See the full explanation below for the reasoning.
Functions
Question
What is the output of the following code?
function increment ($val)
{
$val = $val + 1;
}
$val = 1;
increment ($val);
echo $val;
Options
- A1
How the community answered
(28 responses)- A100% (28)
Topics
#pass by value#function scope#variable isolation
Community Discussion
No community discussion yet for this question.