|
|
</pre>
Note that only excerpts from the code are shown. NoteEarlier in this article we saw the shorthand to output content of a variable into HTML used '<?=', now we see the two ways of getting PHP to output more complicated HTML code, either by using separate echo commands for each line or using the "heredoc" approach so that one echo can be applied to multiple lines. In the latter way, the syntax allowsrequires a space after echo and after <<< but does not allow any other spaces (ornor tabs) in the two enclosing lines (that precede and follow all the listed output). PHP is even more useful if we want to use conditional instructions or loops. For example, by default Cumulus will set the time-stamp of the highest hourly rain in a day to your rollover time if there is no rain in the day. A conditional could test the PHP variable containing the highest hourly rain, and only output the time-stamp if that conditional is not zero:
<pre>
<th>Rainfall (Highest Hourly)</th>
<td><?= $hourlyrainTH;?>
<td>
<?php
if($hourlyrainTH) echo $ThourlyrainTH;
?>
</td>
</pre>
== Other PHP examples ==
|