Is the following valid PHP?
<?php
function a($a) {
?>
<p><?=$a?></p>
<?php
}
?>
(I know this is not a good idea, just want to know if it's possible.)
<?php
function a($a) {
?>
<p><? echo $a?></p> //echo variable content's
// <? ?> is allowed only if you have **Enabled short_tages in php.ini file**
<?php
}
?>
Enable short_tages in php.ini file
<?
$a="stackoverflow";
function a($a) {
?>
<p><?= echo $a?></p>
<?
}
a($a);
?>
If you try to run this program using <?=
this won't allowed it will give you error
Parse error: syntax error, unexpected T_ECHO
<?= is not allowed in php for tags <? is allowed if Set
short_open_tag=On
in php.ini
As of PHP 5.4.0, <?= ?>
PHP tags are available regardless of short_open_tag ini setting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With