PHP - Functions
What will this PHP code output?
$x = 5;
function foo() {
$x = 10;
global $x;
echo $x;
}
foo();
$x = 5;
function foo() {
$x = 10;
global $x;
echo $x;
}
foo();
$x = 10; before declaring global $x; causes a fatal error because the same variable cannot be both local and global in the same scope.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions