ExamVeda
Login
Home
Operators and Expressions in php
?

What will be the output of the following PHP code ?
<?php
function fun()
{
    $x = 0;
    echo $x;
    $x++;
}
fun();
fun();
fun();
?>

Answer & Solution
Correct Answer: Option C
Every time the function is called the value of x becomes 0, therefore we get 0 on every function call.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.