Re: !isset ??
| From: | LaserJetter | Date: | Fri, 08 Feb 2002 16:10:30 +0000 |
| Subject: | Re: !isset ?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84010@lists.php.net to get a copy of this message | ||
If you try and use $var in an operation ( i.e. .= < == etc) and you
get an error saying "Undefined variable" then isset($var) = FALSE
LJ
"Erik Price" <pricee@hhbrown.com> wrote in message
news:0C6A07A3-1B3D-11D6-A011-0050E4857868@hhbrown.com...
> Hm. I hope I'm not opening an old wound:
>
> Curious about the proper way to test for the existence of a variable, I
> decided to read up on isset() at php.net's function manual pages. It
> seems at first to be a way to test whether or not a variable has been
> set.
>
> But reading the annotations below the documentation is mind boggling.
> Back and forth, it seems to go -- and then to find out that one method
> is to be used to test for POSTed variables, and another to be used for
> GETted variables (for $_POST, use "$_POST['var'] !='' ", and for
> $_GET,
> use "!isset($_GET['var'])").
>
> Pretty confusing. Can anyone shed some light on whether or not there is
> a final definite way to do this? I've used (!($_POST['var'])) with no
> problems in the past, but does good coding style suggest that I use
> (!isset($_POST['var'])) now?
>
>
> Erik
>
>
>
>
>
> ----
>
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> pricee@hhbrown.com
>