-
What will be the output of the following PHP code ?
<?php
function calc()
{
static $p = 5;
echo $p;
$p++;
}
calc();
calc();
calc();
?>
-
- 5
- 56
- 567
- 5678
- None of these
Correct Option: C
When static is used, each time the function is called, that variable will still have the information it contained from the last time the function was called.