This will always be printed as the if is closed by the PHP close tag. This will always be printed as the elseif is closed by the PHP close tag. This will always be printed as the else is closed by the PHP close tag. This will always be printed as the for is closed by the PHP close tag. $c); // Surprisingly enough not a parse error. /* testForEachWithoutBodyDueToCloseTag */ foreach($a as $b => $c) ?> This will always be printed as the foreach is closed by the PHP close tag. $v) { // phpcs:ignore Stnd.Cat.Sniff -- for reasons. } /* testForEachWithCode */ foreach ($a as $k => $v) { echo "Key: $k; Current value of \$a: $v.\n"; } /* testWhileWithoutBody */ while (++$i <= 10) /*comment*/ ; /* testWhileWithoutBodyDueToCloseTag */ while (++$i <= 10) ?> This will always be printed as the while is closed by the PHP close tag. something'; break; } /* testDeclareWithoutBody */ declare(ticks=1); /* testDeclareWithoutBodyDueToCloseTag */ declare(ticks=1) ?> $v): // Comment. endforeach; /* testAlternativeForeachWithCode */ foreach ($a as $k => $v): echo "Key: $k; Current value of \$a: $v.\n"; endforeach; /* testAlternativeWhileEmptyBody */ while (++$i <= 10): // phpcs:disable Stnd.Cat.Sniff -- for reasons. endwhile; /* testAlternativeWhileWithCode */ while (++$i <= 10): echo $i; endwhile; /* testAlternativeSwitchEmptyBody */ switch ($foo) : endswitch; /* testAlternativeSwitchWithCode */ switch ($foo) : case 1: echo '