On the html page I open the php tag, the variables declared in one block of tags are not visible in another. There is no such problem on php 5.6. I have nginx + php-fpm, linux mint
Closed due to the fact that off-topic participants cheops , aleksandr barakin , Streletz , user207618, HamSter 11 Oct '16 at 6:12 .
It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:
- “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - cheops, aleksandr barakin, Streletz, Community Spirit, HamSter
|
1 answer
With PHP 5.4.0, the special short <?= Tag is always available, but the usual short tags <? must be enabled with the directive short_open_tag=On
Therefore, the code
<? $a='Ivan'?> NOT executed. That is, the variable $ a is not assigned anything.
And the code
<?=$a ?> already executed, and honestly tells us that the variable is not set
It is also worth noting that the use of short tags <? ?> <? ?> not recommended, because they are far from being allowed everywhere and the code, respectively, loses much of portability.
<?=$a>this is not correct so<?=$a ?>- Naumov- @Naumov yes, copied from the author, not paying attention. thanks - rjhdby
|
<?=since version 5.4 is always enabled and does not depend on short_open_tag ....... so you need to look ini - Alexey Shimansky