-
What will be the output of the following PHP code?
<?php
$option2 = "Hey";
function fun($option1)
{
echo $option1;
echo $option2;
}
fun("Welcome");
?>
-
- Error
- Welcome
- Hey
- Nothing
- None of these
Correct Option: B
If you want to put some variables in function that was not passed by it, you must use “global”. Inside the function type global $option2.