Discussion :: PHP - CS
-
What will be the output of the following PHP code ?
<?php
$x = 5;
function fun()
{
$x = 10;
echo "$x";
}
fun();
echo "$x";
?>
Answer : Option B
Explanation :
First when the function is called variable x is initialised to 10 so 10 is printed later the global value 5 is printed.
Be The First To Comment