Forum Moderators: coopster

Message Too Old, No Replies

<?= instead of <?php

Is this the same?

         

maff

7:31 pm on Sep 21, 2007 (gmt 0)

10+ Year Member



Hi!

I've just been looking through some coding and saw this being used:
<?=etc etc etc?>

I always thought that it had to be:
<?php etc etc etc?>

Are the two the same?

Cheers!

dreamcatcher

7:38 pm on Sep 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi maff,

This page may help you:
[uk.php.net...]

dc

maff

7:46 pm on Sep 21, 2007 (gmt 0)

10+ Year Member



Okay cheers! Do you know what the "=" is for then?

whoisgregg

7:59 pm on Sep 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<?=$var;?> is shorthand for <?php echo $var;?>

It's described under the directive short_open_tag on the link that dreamcatcher provided. :)

maff

8:02 pm on Sep 21, 2007 (gmt 0)

10+ Year Member



Excellent! didn;t spot that. Cheers!

henry0

9:08 pm on Sep 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



BTW Am I not correct to believe that PHP6 will not allow short tag?

So if this is implemented even turning on (now) short tag in your .ini
becomes quite obsolete

Actually what is the in depth reason for not allowing short tag aside portability reason?

phparion

10:24 am on Sep 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I will discourage you to use short tags. One reason is their On and Off state in php.ini varies with PHP versions second very critical reason is that you will face lots of errors while working with strict XHTML or XML files in PHP.

Good programming practice is to use <?php?> tags always.