[thelist] PH isset and is_empty

Mike Migurski mike-evolt at teczno.com
Thu Jul 3 13:37:12 CDT 2003


>Looking at the manual, it seems the following should work:
>
>If (isset($var))
>
>But if I type in nothing, it still returns true, which I don't
>understand at all.

isset() tells you whether the variable exists, and this case it does - it
just happens to point to an empty string. Try print_r()'ing your get or
post vars or use gettype() to see what is set and what its value is.
is_null() won't work for the same reason that $var === false won't - your
$var is a string type, not a null or boolean. is_empty() or empty() are
pretty much your only options in this case.

read more about nullness here:
http://php.net/manual/en/language.types.null.php

and rtfm here:
http://php.net/manual/en/function.isset.php

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca            http://mike.teczno.com/contact.html



More information about the thelist mailing list