LoginSignup
54
42

More than 5 years have passed since last update.

<?php echo のショートタグ<?= は推奨される書き方でした

Last updated at Posted at 2016-02-26

ただし、PHP 5.4.0以降です。

short_open_tag = on は

<?php を <? で始められるようにする設定でした。

short_open_tagoffが推奨であるのは、xmlの記法である、<? ?>が誤動作する危険性があるためです。
現状でもoffが推奨されているはず。

<?= は<?php echo のショートタグ

<?=<?php echoのショートタグですが、こちらはPHP 5.4.0以降、short_open_tagの設定にかかわらず有効です。

すなわち、非推奨である、short_open_tag = on に影響されないで、いつでも使えるようになったのです。

流石

_人人人人人人人人人人人人人人人_
> PHP: Hypertext Preprocessor <
 ̄Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y ̄

大丈夫になったはずって思ってたけど、理由が、記憶の彼方に飛んでいってしまっていたのでここにも書いておきます。

54
42
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
54
42