Vidyalelo
PHP · Q28

Basic PHP

Programming · PHP · question 28

Q28

What is the value of a and b after the function call?

A.
a is 3 and b is 4
B.
a is 4 and b is 3
Answer
C.
Both are 3
D.
Both are 4

Answer: Option B

Solution

Answer: Option B
Solution:
b is 3. The former because $arg is passed by reference, the latter because the return value of the function is a copy of the initial value of the argument.