ExamVeda
Login
Home
Control Structures(Loop in PHP)
?

What will be the output of the following PHP code ?
<?php
$user = array("Ashley", "Bale", "Shrek", "Blank");
for ($x=0; $x < count($user) - 1; $x++)
{
    if ($user[$x++] == "Shrek") 
    continue;
    printf ($user[$x]); 
}
?>

Answer & Solution
Correct Answer: Option A
Only Bale is printed as $x++ is done before printing and then checked.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.