?
What will be the output of the following PHP code ?
What will be the output of the following PHP code ?
<?php
$user = array("Ashley", "Bale", "Shrek", "Blank");
for ($x = 0; $x < count($user); $x)
{
if ($user[$x++] == "Shrek")
continue;
printf ($user[$x]);
}
?>
<?php
$user = array("Ashley", "Bale", "Shrek", "Blank");
for ($x = 0; $x < count($user); $x)
{
if ($user[$x++] == "Shrek")
continue;
printf ($user[$x]);
}
?>
Answer & Solution
Correct Answer:
Option
B
x is incremented only inside loop i the if condition.
Join the Discussion
Login to post a comment or share your explanation.
Login