This is a discussion on Is it ok to use error_reporting(0) to get rid of error msg? within the PHP Language forums, part of the PHP Programming Forums category; "steve" <UseLinkToEmail@dbForumz.com> wrote in message news:41ef3143$1_4@alt.athenanews.com... > Patrick, it ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
"steve" <UseLinkToEmail@dbForumz.com> wrote in message
news:41ef3143$1_4@alt.athenanews.com... > Patrick, it is recommended that you keep as much error reporting as > possible, to make sure you have sufficiently debugged your code. I wouldn't go so far as to imply that keeping error_reporting high can somehow improve the quality of your code. It doesn't. A PHP script that doesn't print out error messages is like a C program that successfully compiles. The computer might not see any problem, but the computer is also stupid as hell. It has absolutely no clue how your program is supposed to work. To its assertion that a piece of code is error-free I wouldn't attach any value. Error_reporting is a tool for fixing bugs, that's all. Most of the time it's useful. If you decide not to use it, that's fine too. |
|
|||
|
> > The point is you can say > > if ($a ==1) $b = 2; > > here, $b is defined only if the condition is met. If then later on, > you call on $b (and the condition was not met) then you get a > "undefined" warning from php. So defensive programming would call > for: > > if ($a ==1) { > $b = 2; > } > else { > $b = ''; > } Hi Steve and everybody who was kind to answer. Thanks to your example Steve I got it now. I am a newbie and some concepts are sometimes hard to grasp at first. I haven't fixed my code but I know where the error comes from now. I have a portion of my guestbook code used for language filter. When the code processes a bad word it doesn't send the error message as the variable in charge of replacing the bad word with **** has a value, but when it compares a good word, a portion of the code isn't processed so now the variable in charge of assigning the **** which replace the bad word has no value so the error pops up. Thanks a bunch to everybody Patrick |