Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #1471
| From | dougatmilmacdotcom@example.com (Doug Miller) |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: evaluating a null value in an array |
| Date | 2011-05-07 23:46 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <iq4lkp$aad$1@dont-email.me> (permalink) |
| References | <5uWdnXAptq8EsVjQnZ2dnUVZ_sidnZ2d@cablespeedmi.com> <iq3asi$cn8$1@dont-email.me> <iq3scb$gre$2@dont-email.me> |
In article <iq3scb$gre$2@dont-email.me>, Gregor Kofler <usenet@gregorkofler.com> wrote: >Am 2011-05-07 13:36, Jerry Stuckle meinte: >> On 5/7/2011 7:27 AM, bill wrote: >>> I have an array of values, one of which might be null. >>> >>> This statement fails >>> if ( ($dos <= $insInfo[3]) or($dos == '0000-00-00')) >>> >>> with the error: >>> Notice: Undefined offset: 3 in /var/www/MP2010-v2/classes/cDollar.php on >>> line 237 >>> >>> when $insInfo[3] is NULL. >>> >>> I figured I could shortcut the evaluation with: >>> >>> if ( ( is_null($insInfo[3])) or($dos <= $insInfo[3]) or($dos == >>> '0000-00-00')) >>> >>> but I get the same error. >>> >>> I sure would appreciate: >>> knowing why I get the error, and >>> a suggestion on how to evaluate this value. >>> >>> bill >> >> Is it null, or is it not set? There is a difference! > >Which isset() won't spot. Nonetheless, isset() is the right function to use here. is_null($x) fails if $x is not set; isset($x) does not.
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
evaluating a null value in an array bill <nobody@spamcop.net> - 2011-05-07 07:27 -0400
Re: evaluating a null value in an array Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-07 07:36 -0400
Re: evaluating a null value in an array Gregor Kofler <usenet@gregorkofler.com> - 2011-05-07 18:35 +0200
Re: evaluating a null value in an array dougatmilmacdotcom@example.com (Doug Miller) - 2011-05-07 23:46 +0000
Re: evaluating a null value in an array Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-05-08 13:56 +0200
Re: evaluating a null value in an array Gregor Kofler <usenet@gregorkofler.com> - 2011-05-08 20:18 +0200
Re: evaluating a null value in an array bill <nobody@spamcop.net> - 2011-05-07 13:50 -0400
Re: evaluating a null value in an array Denis McMahon <denis.m.f.mcmahon@gmail.com> - 2011-05-07 15:30 +0000
Re: evaluating a null value in an array Gregor Kofler <usenet@gregorkofler.com> - 2011-05-07 18:34 +0200
csiph-web