PHP endfor Keyword

PHP endforeach Keyword
PHP enddeclare Keyword

In this article, you will learn how to end the for loop block in PHP. The endfor keyword in PHP is used to close the code block of a for loop which was started using the for(…): syntax.

examples of the ENDFOR keyword

Example 1. In this example, we close a for loop block.

<?php
for($i = 0; $i < 10; $i += 2):
  echo "$i <br>";
endfor;
?>
PHP endforeach Keyword
PHP enddeclare Keyword
en English
X
Scroll to Top