notice and warning
- From: Jeff <jeff@xxxxxxxxxxxxxxx>
- Date: Wed, 16 Jul 2008 11:22:31 -0400
I turned on errors in php:
ini_set('display_errors','1');
And I got a slew of notices and a couple of warnings.
The notices are mostly missing indexes from doing things like this:
$some_var = $_REQUEST['some_name'];
And the warnings are when I have something like this:
Missing argument 1 ...
function someFoo($var1){
if($var1){...}
}
someFoo();
So, I turned display_errors back off, but wonder if I should do anything about the this.
What is good programming practice?
Generally I care more about whether a variable is null or empty, and not whether it has been set, which is what the "notices" seem to be about. If I were to do this:
if(isset($var1)){
// I'd still have to do this:
if($var1){...
PHP is a new language for me, and I'd like to write "correctly"...but I don't want to bloat the code either.
Oh, one more thing, I slipped into perl mode and did this: $SOME_ARRAY{some_key} and got no complaints, Is that "kosher"?
Jeff
.
- Follow-Ups:
- Re: notice and warning
- From: Michael Fesser
- Re: notice and warning
- From: Erwin Moller
- Re: notice and warning
- From: Jerry Stuckle
- Re: notice and warning
- Prev by Date: constructions
- Next by Date: Re: php in terminal shell
- Previous by thread: php in terminal shell
- Next by thread: Re: notice and warning
- Index(es):
Relevant Pages
|