?
What will be the output of the following PHP code ?
What will be the output of the following PHP code ?
<?php
static $x = 0;
function fun()
{
echo $x;
$x++;
}
fun();
fun();
fun();
?>
<?php
static $x = 0;
function fun()
{
echo $x;
$x++;
}
fun();
fun();
fun();
?>
Answer & Solution
Correct Answer:
Option
C
Since variable x is not defined inside the function fun(), nothing will be printed.
Join the Discussion
Login to post a comment or share your explanation.
Login