Jump to content

<?php/**/ does not work as opening tag, as opposed to <?/**/


renergy

Recommended Posts

Something between a "biiig discovery, duh" and "still wonder why" comment.

 

While converting some older scripts with short opening tag, I have found the following does not work

<?php/*
blah blah
blah
*/
echo "hey";?>

I.e. the comment cannot start immediately after the opening tag. There has to be a whitespace after the "<?php", it cannot be "postponed" by the comment. Am I the only one who finds this a bit strange? While I understand that e.g. 

<?phpecho"a"?>

does not make any sense, as opposed to <?echo"a"?>, I had somehow expected the /**/ comment to work as a whitespace. It obviously does not.

 

Perhaps the fact that the opening tag is "<?php[whitespace]", and not just "<?php", should be stressed more in the manual. Perhaps this just shows my inertia of thinking :)

 

Tried with php 5.5.9 and 5.6.6, short_open_tag=0 (obviously)

Link to comment
https://forums.phpfreaks.com/topic/295255--/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.