ExamVeda
Login
Home
This question belongs to PHP Functions
Functions
?

What will be the output of the following PHP code?

<?php
$op2 = "blabla";
function foo($op1)
{
        echo $op1;
        echo $op2;
}
foo("hello");
?>

Answer & Solution
Correct Answer: Option C
If you want to put some variables in function that was not passed by it, you must use “global”. Inside the function type global $op2.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.