whats the meaning of this line
<input type=text name="name" value="<?= $name ?>
if we are to declare as PHP shouldn't we write <?php instead of <?=
Thanks
<?=
are PHP short open tags, which can be enabled (or disabled) via the short_open_tag
directive in php.ini
(quoting) :
This directive also affects the shorthand
<?=
, which is identical to<? echo
. Use of this shortcut requiresshort_open_tag
to beon
.
And:
Also if disabled, you must use the long form of the PHP open tag (
<?php ?>
).
This means your portion of code :
<input type=text name="name" value="<?= $name ?>
Is equivalent to this one :
<input type=text name="name" value="<?php echo $name; ?>
But only when short open tags are enabled.
And, as a sidenote : short open tags are not always enabled -- in fact, they are disabled by default, with recent versions of PHP.
Which means it might be wise to not depend on those, at least if you want to deploy your application on servers on which you are not administrator.
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