There's a small difference between the two cases:
<?php
if (true) {
echo "<h1>Content Title</h1>";
}
?>
Here, because you're using double quotes in your string, you can insert variables and have their values rendered. For example:
<?php
$mytitle = 'foo';
if (true) {
echo "<h1>$mytitle</h1>";
}
?>
Whereas in your second example, you'd have to have an echo enclosed in a php block:
<?php if (true) { ?>
<h1><?php echo 'My Title'; ?></h1>
<?php } ?>
Personally, I use the same format as your second example, with a bit of a twist:
<?php if (true): ?>
<h1><?php echo $mytitle; ?></h1>
<?php endif; ?>
I find that it increases readability, especially when you have nested control statements.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…