How to write php without <?php> -
this question has answer here:
- how enable php short tags? 16 answers
im trying setup php server use
<? echo 'ok'; ?>
syntaxis without 'php' inside opening tag. code works this
<?php echo 'ok'; ?>
how can achieve this? tried install latest version of php, still not working.
answer:
set short_open_tag=on
in php.ini , restart server.
caveat:
short open tags not used according php coding standard psr-1 states:
php code must use long
<?php ?>
tags or short-echo<?= ?>
tags; must not use other tag variations.
the reason mentioned @magnus eriksson there may situations not have access edit php.ini , therefore code uses short tags rendered unusable in environments. adhere standard maximum portability!
Comments
Post a Comment