-
What will be the output of the following PHP code ?
<?php
$t = 2;
function calculation()
{
echo $GLOBALS['t'];
$t++;
}
calculation();
calculation();
calculation();
?>
-
- Error
- 2
- 22
- 222
- None of these
Correct Option: D
Every time the function is called the value of t becomes 2, therefore we get 2 on every function call.