Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<?= ?> special tags in php [duplicate]

can anybody please explain what are these special tags in php?

<?= ?>

I couldn't find it on google.

like image 551
heapzero Avatar asked Apr 18 '10 14:04

heapzero


3 Answers

See the short_open_tags setting. <?= is identical to <? echo and use of it requires short_open_tag to be on. A term to search for would be "short tags".

As an example: <?='hello'?> is identical to <? echo 'hello' ?> which is a short form of <?php echo 'hello' ?>.

See also Are PHP short tags acceptable to use? here on SO.

like image 130
salathe Avatar answered Sep 23 '22 21:09

salathe


It's part of the short_open_tag. Basically <?=$foo?> is equivalent to <?php echo $foo; ?>

like image 37
Wolph Avatar answered Sep 25 '22 21:09

Wolph


They output what's inside them directly.

<?= "something" ?>

is a shortcut for:

<?php echo "something"; ?>

These (together with <? ?>) are called short tags. See here (short_open_tag)

like image 43
Bozho Avatar answered Sep 25 '22 21:09

Bozho