?
What will be the output of the following PHP code ?
What will be the output of the following PHP code ?
<?php
function fun($x,$y)
{
$x = 4;
$y = 3;
$z = $x + $y / $y + $x;
echo "$z";
}
fun(3, 4);
?>
<?php
function fun($x,$y)
{
$x = 4;
$y = 3;
$z = $x + $y / $y + $x;
echo "$z";
}
fun(3, 4);
?>
Answer & Solution
Correct Answer:
Option
B
Value 3, 4 is passed to the function but that is lost because x and y are initialised to 4 and 3 inside the function. Therefore we get the given result.
Join the Discussion
Login to post a comment or share your explanation.
Login