ExamVeda
Login
Home
Operators and Expressions in php
?

What will be the output of the following PHP code ?
<?php
$x = 4;
$y = 3;
function fun($x = 3, $y = 4)
{
    $z = $x+$y/$y+$x;
    echo "$z";
} 
echo $x;
echo $y;
echo $z; 
fun($x, $y);
?>

Answer & Solution
Correct Answer: Option D
Firstly, the statements outside the function are printed, since z is not defined it’ll no value is printed for z. Next the function is called and the value of z inside the function is printed.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.