Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it now safe to use PHP echo short tags?

Is it now totally and completely safe to use

<?=$var ?> 

instead of

<?php echo $var; ?>
like image 378
Roy Avatar asked Jan 14 '13 20:01

Roy


2 Answers

I wouldn't use the words "totally" and "completely", but with PHP5.4 the "short-open-and-echo"-syntax is part of the core and thus always available. Remind, that I only talk about <?= ?> and not the "regular" short-open-tags <? ?>.

like image 180
KingCrunch Avatar answered Sep 21 '22 11:09

KingCrunch


Yes. As of PHP 5.4.0 from 01-Mar-2012 you can use short tag. From php 5.4 change log,

<?= is now always available regardless of the short_open_tag setting.

This was a General improvement.

So if you have PHP 5.4 you can use <?= syntax.

like image 24
Shiplu Mokaddim Avatar answered Sep 20 '22 11:09

Shiplu Mokaddim