xml declaration cannot be used

Please let me know whether what I should do.

Although I am using a certain template engine, the template for XHTML has the xml declaration at the top, and this will be judged to be an error by PhpStorm.

Is this nonavoidable by change or other means of a setup?

Since a template file may be performed directly, an extension is .php.


If it can do, I would like to write in this way, although a head line can also be written as follows.
<?php echo '<?xml version="1.0" encoding="', $header_encoding, '"?>'; ?>


Hi there

<? and ?> in *.php file are PHP opening and closing tags. Because of that everyting between them (e.g. "xml version" text) is treated as PHP code, which is not actually a valid PHP, hence the error.

Therefore <?php echo '<?xml version="1.0" encoding="' . $header_encoding . '"?>'; ?> is the way to go.


Thank you.

I think that everything but a certain control structure or a label cannot be immediately after an open tag.
Since distinction fully attached xml declaration when becoming, I thought that suitable management could probably be performed.
And it is if correspondence will be possible perfectly if it is wise PhpStorm.
(since it is also possible to turn OFF short_open_tag since the present environment is PHP5.3.x)

Regrettably the method of outputting xml declaration from echo will be taken.
Thank you.


Currently PhpStorm does not differentiate between full and short tags (in other words: it cannot treat (turn off) short tags as normal text)



Under the present circumstances, it seems that there is no way expect  echo (or print).
And future is also likely to be impossible.
thank you very much.


Please sign in to leave a comment.