This example creates the same output as #126, but it is so much easier! By slipping into HTML mode to create the table itself, one saves a lot of typing. Again, this uses the feature of only slipping into the HTML mode if the if statement condition is fulfilled. The big advantage of this process is the avoidance of having to escape the quotation marks and dollar signs, and not needing to wrap output in multiple echo statements. It's possible this technique makes the script less readable, especially if the script is a long one.
| Today's Prices in Dollars | ||
| $14.00 | $32.00 | $71.00 |
<?php
$display_prices = true;
if ($display_prices) {
?>
<table style="border: 1px solid black;">
<tr><td colspan="3">Today's Prices in Dollars</td></tr>
<tr><td>$14.00<td>$32.00</td><td>$71.00</td></tr>
</table>
<?php
}
?>