In a PHP do...while loop, where is the condition tested?

  • At the end of the loop, after executing the code block
  • Before executing the code block
  • At the beginning of the loop, before executing the code block
  • Within the code block itself
In a PHP do...while loop, the condition is tested at the end of the loop, after executing the code block. This means that the code block is always executed at least once, and then the condition is checked. If the condition evaluates to true, the loop continues to execute. If the condition is false, the loop terminates. Unlike other loops, the condition in a do...while loop is evaluated at the end, ensuring that the code block executes at least once before checking the condition for further iterations. Learn more: https://www.php.net/manual/en/control-structures.do.while.php
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *