> What does the ! in if(!isset($id)) { $id = 0; } do? 

It checks for the false return. If isset($id) returns false then the
'if' statement with (!) returns you true, and, as you just guessed, it
will assign a (0) to $id.



> this bit does in general: checks if $id has been assigned anything, if
> it's empty it gets assigned 0. Correct? Then I can use if($id)
> statements later on without having PHP return "Undefined Variable"
> errors. Right?


To stop receiving the messages from undefined variables add this at top
of your files:

error_reporting(55);

 
> Thanks for your help, I'll work on my PHP listetiquette.
> 
> Jason Soza




Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins









> 
> ----- Original Message -----
> From: "1LT John W. Holmes" <[EMAIL PROTECTED]>
> Date: Thursday, April 25, 2002 5:35 am
> Subject: Re: [PHP] Parse Error - Help? (AGAIN)
> 
> > I don't have your original code (which, btw, you shoudn't ever
> > post that
> > much code without explicitly saying what the error was, what line
> > it was
> > one, highlighting that line, and saying what you've done so far),
> > but these
> > errors are caused by not giving a default value to a variable,
> > basically.
> > If you have something like this:
> >
> > if($id = 5)
> > {
> >  //whatever
> > }
> >
> > and $id hasn't been assigned a value, then you'll get that
> > warning. In
> > previous versions of PHP, you wouldn't get the warning, you'd just
get
> > FALSE.
> >
> > So, before you test the value of a variable, or echo the value
> > out, make
> > sure you've assigned it something.
> >
> > if(!isset($id)) { $id = 0; }
> >
> > Hopefully that's not too confusing....it's hard to explain.
> >
> > ---John Holmes...
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to