宣告的替代方案
<?php
for ($i = 0; $i < 10; $i++):
do_something($i);
endfor;
?>
<?php for ($i = 0; $i < 10; $i++): ?>
<p>Do something in HTML with <?php echo $i; ?></p>
<?php endfor; ?>
<?php
for ($i = 0; $i < 10; $i++):
do_something($i);
endfor;
?>
<?php for ($i = 0; $i < 10; $i++): ?>
<p>Do something in HTML with <?php echo $i; ?></p>
<?php endfor; ?>