Loops and Breaking PHP Code
Let's form several paragraphs in a loop:
php<?php
for ($i = 1; $i <= 9; $i++) {
echo '<p>' . $i . '</p>';
}
?>
The code can be rewritten with a PHP break:
html<?php for ($i = 1; $i <= 9; $i++) { ?>
<p><?= $i ?></p>
<?php } ?>
For simplicity, you can use the alternative syntax:
html<?php for ($i = 1; $i <= 9; $i++): ?>
<p><?= $i ?></p>
<?php endfor; ?>
Задание 1
Use a loop to form the following HTML code:
html<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>