PHP difference between notice and warning

后端 未结 6 1510
不知归路
不知归路 2020-12-08 10:09

When writing code errors, warnings and notices can occur. I know the idea behind errors. I suppose a warning is there to inform you about something that can cause an error,

6条回答
  •  庸人自扰
    2020-12-08 10:20

    I won't re-iterate the specific meanings, which have been thoroughly covered by other answers.

    Warnings and notices indicate different "badness" levels for things you might be doing wrong, but I'm with the PEAR/Zend guides on this: you should always code to E_STRICT, which means you shouldn't ever raise either warnings or notices.

    If you follow E_STRICT compatibility, the distinction between notices and warnings is kind of redundant if both are considered "Non-fatal errors that you should make sure don't happen" - they're both essentially warnings.

提交回复
热议问题