As an alternative, you may use Output Control Functions:
Your code becomes:
<?php
ob_start();
?>
<div class='item'>
<img src='chicago.jpg' alt='Chicago'>
<div class='carousel-caption'>
<h3>Chicago</h3>
<p>Thank you, Chicago!</p>
</div>
</div>
<?php
$html_block1 = ob_get_clean();
This way also allows you to move your HTML templates to a view file:
script.php
<?php
ob_start();
require VIEW_FOLDER . '/my_view.php';
$html_block1 = ob_get_clean();
my_view.php
<div class='item'>
<img src='chicago.jpg' alt='Chicago'>
<div class='carousel-caption'>
<h3>Chicago</h3>
<p>Thank you, Chicago!</p>
</div>
</div>
If you’re going to do stuff like this, you should however consider looking into template engines, such as Twig.