Search code examples
phpcodeigniterechofuelphpshorthand

<?= and <? echo in PHP


I'm using PHP frameworks like codeigniter and fuelphp, I read some of it's manual that i's recommending <?= over <?php echo. But I don't use both of them, instead I'm using <? echo, but I'm still not sure if I'm doing it right. I don't feel comfortable using <?=. Need advice from experienced PHP developers. Thanks in advance.


Solution

  • There is no right or wrong for this, it's an opinion based matter. I personally do like to use shorttags when I can because I find it easier to read. Others might find the

     <?php
    

    easier to read and will prefer this. It's a fully opinion based matter and I wouldnt worry about it. Use which you prefer.