Jump to content

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


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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.