Discussion :: PHP - CS
-
What will be the output of the following PHP code ?
<?php
$x = 5;
$y = 10;
function fun()
{
$GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y'];
}
fun();
echo $y;
?>
Answer : Option C
Explanation :
You can access the global variable using $GLOBALS[‘globalvariablename’].
Be The First To Comment