Is it bad practice to use <?= tag in PHP

Posted by marco-fiset on Programmers See other posts from Programmers or by marco-fiset
Published on 2012-06-05T18:14:42Z Indexed on 2012/06/05 22:46 UTC
Read the original article Hit count: 260

Filed under:
|

I've come across this PHP tag <?= ?> recently and I am reluctant to use it, but it itches so hard that I wanted to have your take on it. I know it is bad practice to use short tags <? ?> and that we should use full tags <?php ?> instead, but what about this one : <?= ?>?

It would save some typing and it would be better for code readability, IMO. So instead of this:

<input name="someVar" value="<?php echo $someVar; ?>">

I could write it like this, which is cleaner :

<input name="someVar" value="<?= $someVar ?>">

Is using this operator frowned upon?

© Programmers or respective owner

Related posts about php

Related posts about shortcuts