Home » PHP » PHP For Loops » Question
  1. What will be the output of the following PHP code ?
    <?php
    $stu = array("Ajit", "Ats", "Aju", "Rahul");
    for ($g=0; $g < count($stu) - 1; $g++)
    {
    if ($stu[$g++] == "Ats")
    continue;
    printf ($stu[$g]);
    }
    ?>
    1. AjitAtsAjuRahul
    2. AjitAtsAju
    3. AtsRahul
    4. AjitAts
    5. None of these
Correct Option: C

Only Bale is printed as $g++ is done before printing and then checked.



Your comments will be displayed only after manual approval.