How to write php without <?php> -


this question has answer here:

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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -