×

Multiple-Choice Questions

Web Technologies MCQs

Computer Science Subjects MCQs

Databases MCQs

Programming MCQs

Testing Software MCQs

Digital Marketing Subjects MCQs

Cloud Computing Softwares MCQs

AI/ML Subjects MCQs

Engineering Subjects MCQs

Office Related Programs MCQs

Management MCQs

More

What will be the output of the following PHP code (24)?

98. What will be the output of the following PHP code?

<?php
for ($i = 1;$i <= 10;$i++){
    if ($i == 6){
        continue;
    }
    echo "$i ";
}
?>
  1. 1 2 3 4 5 7 8 9 10
  2. 1 2 3 4 5 6 7 8 9 10
  3. 1 2 3 4 5 6
  4. 1 2 3 4 5

Answer: A) 1 2 3 4 5 7 8 9 10

Explanation:

In the above PHP script, we used the continue statement when $i==6, the continue statement does not echo the value of $i when the value of $i is 6 and transfer the control again to the loop. Thus. The output will be "1 2 3 4 5 7 8 9 10".

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.