CKTIS / PHP
Keyword endfor
Close a colon-style for body, commonly around template output.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
for ($i = 0; $i < $n; ++$i): /* body */ endfor;Close a colon-style for body, commonly around template output. The update expression still runs after each completed pass and after continue. The condition is checked before each pass, so an empty range emits no rows. Use the semicolon after endfor.
$out="";
for($i=0;$i<4;++$i): if($i===1){continue;} $out.=$i; endfor;
echo $out;
023
Examples
<?php
$out="";
for($i=0;$i<4;++$i): if($i===1){continue;} $out.=$i; endfor;
echo $out;
Result
023