Sąlygos ir PHP kodo pertraukimas

Tarkime, kad turime tam tikrą kintamąjį:

html<?php
  $test = true;
?>

Išveskime kokį nors HTML kodo fragmentą, jei mūsų kintamasis yra lygus true:

html<?php
  if ($test) {
    echo '<p>text</p>';
  }
?>

Galime perdirbti šį kodą į tokį, su PHP skliaustų pertrauka:

html<?php if ($test) { ?>
  <p>text</p>
<?php } ?>

Tai galima supaprastinti dar labiau, jei pasinaudotume alternatyvia if sintakse:

html<?php if ($test): ?>
  <p>text</p>
<?php endif; ?>
Задание 1

Duotas kintamasis:

html<?php
  $show = true;
?>

Duotas kodas:

html<div>
  <p>text1</p>
  <p>text2</p>
  <p>text3</p>
</div>

Išveskite nurodytą HTML kodą, jei kintamasis show yra lygus true.