!isset ??
| From: | Erik Price | Date: | Wed, 06 Feb 2002 20:06:46 +0000 |
| Subject: | !isset ?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-83746@lists.php.net to get a copy of this message | ||
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