Is there a php.ini setting to turn <?=$phpval?>
-style output on, or has someone on this project been smoking too much ASP?
Yes,
<?php $var = 'Hello, World!"; ?>
<?= $var ?>
Is the same as;
<?php $var = 'Hello, World!"; ?>
<?php echo $var; ?>
There is, but it is deprecated. You are looking for short_open_tag
which enables <?
(DANGER because of xml opening tags that are the same) and <?=
(no danger)
As of php 5.4, <?=
will be enabled even if short_open_tag
is set to Off. See the documentation.
Yes, Its a valid statement, and as @greg0ire mentioned you can turn it on by editing the short_open_tag
in php.ini however using <?php
has been known as a better practice specially if you are writing your application for sale to the public, because <?php
would work with most shared hosting configurations however <?
is sometimes not allowed/not activated, so its easier for users to use your script if you use <?php
.