Re: Consider only ignoring newlines for final ?> in a file
| From: | Christoph M. Becker | Date: | Thu, 07 Sep 2017 14:00:35 +0000 |
| Subject: | Re: Consider only ignoring newlines for final ?> in a file | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100443@lists.php.net to get a copy of this message | ||
On 07.09.2017 at 15:43, Andrea Faulds wrote:
> Ah. See, it's actually that kind of code that is my problem. A practical
> example would be:
>
> <table>
> <?php foreach($rows as $row): ?>
> <tr>
> <?php foreach ($row as $column): ?>
> <td><?=htmlspecialchars($column)?></td>
> <?php endforeach; ?>
> </tr>
> <?php endforeach; ?>
> </table>
I start the "control flow lines" always on column 0 (similar to C
preprocessor instructions), what gives the desired output and is quite
readable:
<table>
<?php foreach($rows as $row): ?>
<tr>
<?php foreach ($row as $column): ?>
<td><?=htmlspecialchars($column)?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</table>
--
Christoph M. Becker