Shorter way to repeat variable in php?

Over the past two days, ive has been running code that has php echo'd variables displayed as follows

<?=$selected?> 

What exactly is happening and why? What is called?

+3
php
source share
1 answer

This is called a Short Tag. This is a shortcut for <?php echo $selected;?> . It is widely accepted, but there is a lot of literature that does not recommend using it, since this leads to less portable code (many PHP installations do not contain short tags). I agree, just take a look at this user is running . See also:

Are PHP short tags usable?

+10
source share

All Articles