I recently switched to a new setup that is reporting PHP Notices; my code has worked fine without these notices being fixed, but I am wondering if it makes sense to fix every one and leave them reported or just ignore them and turn notice reporting off.
What are some different opinions on this? Are there any best practices associated with notices?
Errors are errors. They have to be fixed before your code works.
Warnings are warnings. They warn you that what you’re doing is probably a bad idea, even if it works (or seems to work) for you at the moment. So they too should probably be fixed.
Notices are notices. They should be noticed. Hence the name. It may not be a problem that your code generates some, but it’s something you should examine and judge on a case-by-case basis.
And of course, it is much easier to notice notices if you don’t get 400 of them. So there’s a big benefit to trying to eliminate them. It makes the ones you haven’t yet noticed become more noticeable.