this question has answer here:
- how can echo html in php? 10 answers
specifically speaking, why below code work (outputs "test").
<? $variable = 'test'; ?> <?=$variable?>
is hacky, or functionality?
<?=?>
short tag echo();
according php
outputs parameters.
echo not function (it language construct), not required use parentheses it. echo (unlike other language constructs) not behave function, cannot used in context of function. additionally, if want pass more 1 parameter echo, parameters must not enclosed within parentheses.
echo has shortcut syntax, can follow opening tag equals sign. prior php 5.4.0, short syntax works short_open_tag configuration setting enabled.
gives next example:
i have
<?=$foo?>
foo.
Comments
Post a Comment