Home > Net >  I am confused as to how this PHP code is not only valid but produces no syntax errors?
I am confused as to how this PHP code is not only valid but produces no syntax errors?

Time:10-12

I did a find-replace and made a mistake which led to the following code being on it's own line.

16;

This caused a lot of issues as it did not produce any errors anywhere and I am very surprised. How is this possibly valid PHP code?

CodePudding user response:

16 is a valid literal. In itself it is a valid expression. 16; is a statement made up of the expression 16 which consists of the single value 16. There's nothing invalid. It simply doesn't do anything.

  • Related