RE: [PHP-DEV] short_open_tag
| From: | Jared Williams | Date: | Sun, 23 Mar 2008 01:20:53 +0000 |
| Subject: | RE: [PHP-DEV] short_open_tag | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-36347@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Stefan Walk [mailto:stefan.walk@gmail.com]
> Sent: 22 March 2008 22:52
> To: 'PHP Internals'
> Subject: Re: [PHP-DEV] short_open_tag
>
> Johannes Schlüter schrieb:
> > Now we have the big issue: Do we want to have short open
> tags forever?
> > Well, without tooo much thinking my idea would be to drop "<?" but
> > keep "<?=", "<?=" shouldn't conflict with <?xml tags in
> > the
> same file,
> > but make it simple to do templating using PHP, on the other
> hand when
> > not echo'ing stuff you already have to write more soo the four
> > additional characters ("php ") don't matter that much - especially
> > every decent editor/ide should be able to give you a
> completion on that, if you want.
>
> <ul>
> <? foreach ($items as $item): ?>
> <li><?=$item?></li>
> <? endforeach ?>
> </ul>
The problem I have with <?= is it doesnt really help simplify templating.
You end up still having to explicitly encode the output with
htmlspecialchars() or whatever.
<ul>
<? foreach ($items as $item): ?>
<li><?=htmlspecialchars($item)?></li>
<? endforeach ?>
</ul>
So <?= ends up not really that much of an improvement over <?php echo
htmlspecialchars($item); ?> imo.
J