Re: isset
| From: | Al | Date: | Mon, 16 Apr 2007 23:43:37 +0000 |
| Subject: | Re: isset | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-253082@lists.php.net to get a copy of this message | ||
I've been using empty() for about 5 years, obeying the rules for empty() in the php manual
"Appendix P. PHP type comparison tables" and have never seen it generate any type of error message.
If you guys know of at least one exception, please clue us in on it.
Jim Lucas wrote:
Stut wrote:tedd wrote:these two lines are not the same infact, with the first, you will not get a E_NOTICE warning, but with the second you will.At 4:08 PM +0100 4/16/07, Stut wrote:In the above example, if (isset($_GET['something']) && !empty($_GET['something'])) { is the same as... if (!empty($_GET['something'])) { So, in that particular line of code the isset is a pointless waste of cycles. -StutJim Lucas wrote:I've been accuse of that too, but what's your solution?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']}