Discussion :: PHP - CS
-
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 : Option D
Explanation :
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.
Be The First To Comment