Ask coding questions

← Back to all posts
PHP opening tag error
adriaangijssen (8)

When I create a PHP script with opening tag, a syntax error pops up:
syntax error, unexpected '<', expecting end of file

When I remove the opening tag (bad programming!), then the script runs fine. But the syntax highlighting don't work. I know the workaround for highlighting: put the opening tag in comments.

I hope this is a bug and will be fixed soon. Is there any more information available?

Answered by enigma_dev (509) [earned 5 cycles]
View Answer
enigma_dev (509)

Do you have any repl link you can give meß I may look into it.

enigma_dev (509)

@adriaangijssen It seems like never needed the opening tab. But, is that a problem? Absolutely not! But the syntax highlighting thing seems like a bug tho. I am going to report it to a team member, ok? I would really appreciate if you would mark my answer with the answered batch.

adriaangijssen (8)

@enigma_dev In the past it was no problem to use an opening tag. It's not a big problem, but if you're, in my case, learning students PHP, you have to learn them the correct syntaxis. If you combine PHP with HTML, an opening tag is needed.
It would be great if in the use of an opening tag is optional, not 'forbidden'.

It's great if you would report that highlighting bug! How do I mark your answer as the correct answer? I'm new at the forum. ;-)

enigma_dev (509)

@adriaangijssen From what I now, there is a button next to my answer above, which looks like a tick box or a green hook. Click on it and confirm that you want to mark it. See this post for further help:
marking it remarks me with 5 cycles, which is pretty neat. if you want to even give me more upvotes, upvote my answers under this post via the +1 looking like screen

adriaangijssen (8)

@enigma_dev thanks, just marked you're answer!