Re: isset
| From: | Edward Vermillion | Date: | Mon, 16 Apr 2007 17:14:36 +0000 |
| Subject: | Re: isset | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-253025@lists.php.net to get a copy of this message | ||
On Apr 16, 2007, at 11:27 AM, Jim Lucas wrote:
Stut wrote:empty() does NOT produce an E_NOTICE if the variable is not set. That's one of the things it considers as empty. And why I always do !empty($foo) then check for a value such as (!empty($foo) && $foo == $bar)Jim Lucas wrote:well, as the OP said, he wants to know when the variable has a value other the "". So, to check for that you have to do something like this right? if ( $var != '' ) {} if ( strlen($var) > 0 ) {} if ( !empty($var) ) {} ... a number of other ideas come to mind, but none of them will work, because they will always product a E_NOTICE warning.Richard Kurth wrote:The isset is a pointless waste of cycles. -StutWhat do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set. Because $_REQUEST['var'] = "" and isset thinks "" is setI use this combination a lot: if ( isset($_GET['something']) && !empty($_GET['something']) ) {// do something here with $_GET['something']}