Which of the following PHP loops checks the condition before the loop has run?

  • while loop
  • for loop
  • do-while loop
  • foreach loop
The while loop in PHP checks the condition before the loop has run. The condition is evaluated at the beginning of each iteration. If the condition evaluates to true, the loop will run and execute the block of code. If the condition evaluates to false from the start, the loop will not be executed. The while loop is used when you want to repeat a block of code based on a specific condition, and the condition is checked before the loop begins. Learn more: https://www.php.net/manual/en/control-structures.while.php
Add your answer
Loading...

Leave a comment

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