Q. What will be the output?
Code:
function foo() {
static $x = 0;
$x++;
return $x;
}
echo foo() . foo();
β
Correct Answer: (B)
12
Explanation: Static variable retains value across calls.