?
What will be the output of the following PHP code ?
What will be the output of the following PHP code ?
<?php
$x = 75;
$y = 25;
function addition()
{
$GLOBALS['z'] = $GLOBALS['x'] + $GLOBALS['y'];
}
addition();
echo $z;
?>
<?php
$x = 75;
$y = 25;
function addition()
{
$GLOBALS['z'] = $GLOBALS['x'] + $GLOBALS['y'];
}
addition();
echo $z;
?>
Answer & Solution
Correct Answer:
Option
A
z is a variable present within the $GLOBALS array, it is also accessible from outside the function!
Join the Discussion
Login to post a comment or share your explanation.
Login