In PHP what is this tag? =? represents? [duplicate]

6

In PHP what does this tag represent?

Opening tag:

<?= 

Closing Tag:

?>
    
asked by anonymous 10.12.2015 / 18:31

2 answers

10

This syntax is a shortcut to this:

<?php echo  ; ?>

Prior to PHP 5.4 the short tags option should be enabled to be able to use this shortcut. In PHP 5.4 this option is always available.

So much so that this syntax is specified in echo documentation .

Example:

<p>Meu nome é <?=$nome?></p>

is equivalent to

<p>Meu nome é <?php echo $nome; ?></p>

Prior to this change in PHP 5.4, the use of% implicit% was problematic, since the short opening tags echo were confused with XML statements, and usually the hosting usually keeps this option off.

As the <? ?> sign would serve in theory for disambiguation in these cases, it was decided to enable this option separately from the setting of the short tags.

    
10.12.2015 / 18:34
3

This directive also affects the abbreviated form <?= prior to PHP 5.4.0, which is the same as <? echo . To use this abbreviation it is necessary that short_open_tag is active. Since PHP 5.4.0, <?= is always available.

Reference from: link

    
10.12.2015 / 18:34