Home »
MCQs »
PHP MCQs
What will be the output of the following PHP code (1)?
18. What will be the output of the following PHP code?
<?php
$x = 5;
function myFunction(){
echo "Result $x";
}
myFunction();
?>
- Result $x
- Result 5
- Result
- None of the above
Answer: C) Result
Explanation:
The variable x is a global variable, and can only be accessed outside a function.