Learn PHP from scratch Quiz 1

Hi, for this quiz Learn PHP from Scratch Quiz 1, question 3:

Which of the following changes would prevent the error from occuring

<?phpecho "My name is Jerry"

There are two potentially correct answers, which I tested, but one is marked wrong.

The two possible answers are:

B) The end symbol ?> is missing


C) Semicolon is missing at the end of the code statement

I tested both (putting a semicolon after the end quotes without the closing tag and putting a closing tag without the semicolon), and both answers are correct.

Is this an oversight, or is there something I am missing?
Thank you.

Hi Excel_Chukwu,
Yes you are right but if the last code statement doesn’t end with a semicolon but ends with a closing tag, then the semicolon becomes optional in that case.

Yes please, I understand that.
What I’m not sure I understand is why the other is marked wrong since in this case, putting a semicolon at the end of the statement also makes the closing tag optional… :thinking: