PHP コードタグ

PHP コードを区分するためには、短縮型の <? ?> ではなく、 かならず <?php ?> を使用してください。 PEAR のルールであると言うだけでなく、オペレーティングシステムや設定が異なる情况で PHP コードを読み込む際の最も互換性の高い方法でもあります。

コードの読み込み (Previous) ヘッダコメントブロック (Next)
Last updated: Tue, 24 Nov 2015 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

Note by:
What about <?= ?> and <?php= ?> ?
Note by:
It's applicable in any script which ends with PHP code, e.g.

// Something here

<div>Some HTML here</div>
// Some other code here?>
Note by:
Not including the closing ?> is only applicable when the file only contains PHP code.
Note by: pear at alan
Drupal code styles suggest avoiding the final closing ?>.

They do so as to minimize the chance of content being sent by whitespace (sometimes inserted by FTP clients) after the closing town, which may prevent proper sending of headers.

Does PEAR care either way? Is it OK to avoid the final closing PHP tag?