Question

I recently turned all possible error-messages on with error_reporting(-1);, on my PHP project. Of course, right away I got alot of messages. For example:

Notice: Undefined variable: foo in /.../file.php on line 205

So I started updating my code to get rid of all the notices. Mostly, by adding isset($foo) and making the $foo = NULL;

So, I'm wondering. How important are these notices really? I mean, if the $foo variable is not set, then it should be false/null/not-set by default..so technically the code works?!

If I would get rid of all notices, then does it make the process faster or slow it down (because I'm adding more code, isset($foo), $foo = NULL etc)? How do you guys deal with these notices, or do you even pay attention to them?
I guess, the most important question is: Should the code be written so strict, that it would never generate any notices or warnings?

No correct solution

Licensed under: CC-BY-SA with attribution
scroll top