PHP endfor Keyword

❮ PHP Keywords

Example

Close a for loop block:

<?php
for($i = 0; $i < 10; $i += 2):
  echo "$i <br>";
endfor;
?>
Try it Yourself »

Definition and Usage

The endfor keyword is used to close the code block of a for loop which was started using the for(...): syntax.


Related Pages

The for keyword.

Read more about for loops in our PHP for Loop Tutorial.


❮ PHP Keywords
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.