Home »
MCQs »
PHP MCQs
What will be the output of the following PHP code (2)?
19. What will be the output of the following PHP code?
<?php
function myFunction()
{
$x = 5;
echo "Result1: $x , ";
}
myFunction();
echo "Result2: $x";
?>
- Result1: 5 , Result2:
- Result1: 5 , Result2: 0
- Result1: 5 , Result2: 5
- None of the above
Answer: A) Result1: 5 , Result2:
Explanation:
The variable x is a local scope, and can only be accessed within that function.