Home » PHP » PHP For Loops » Question
  1. What will be the output of the following PHP code ?
    <?php
    $emp = array("Neha", "Sumi", "Abhay", "Krishna");
    for ($z = 0; $z < count($emp); $z)
    {
    if ($emp[$z++] == "Abhay")
    continue;
    printf ($emp[$z]);
    }
    ?>
    1. Neha
    2. Sumi
    3. SumiAbhay
    4. Krishna
    5. None of these
Correct Option: C

z is incremented only inside loop z the if condition.



Your comments will be displayed only after manual approval.