Difference B/w <?= And <?php Echo

Hi All,

Can anyone help me understand the difference between



<?php echo


I’m new to Yii and Yii2 and looking at the view.php file created by gii, and I see …


		<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>

		<?php echo Html::a('Delete', ['delete', 'id' => $model->id], [

			'class' => 'btn btn-danger',

			'data' => [

				'confirm' => Yii::t('app', 'Are you sure to delete this item?'),

				'method' => 'post',


		]); ?>


In the code above, I see two instances of the Html::a method but I don’t really understand why one uses


and the other uses

<?php echo

If I change both references to use


it seems to echo the content just as

<?php echo


Is there any difference between the two versions? Why does Yii use both options here?

Many thanks for your knowledge!

Actually there’s no difference since short echo tags are always available since 5.4.

So if you found this in Yii2, time to submit an issue to github.

Thanks ORey - here is the url to the issue i submitted. I look forward to the day I’m smart enough to help fix these things!