FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » evaluating a null value in an array
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: evaluating a null value in an array [message #173827 is a reply to message #173825] Sat, 07 May 2011 11:36 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
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!

Try isset() instead of is_null().

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Design minisite with minisite master tutorial
Next Topic: getting only the temperature & general weather condition
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 17:28:38 GMT 2024

Total time taken to generate the page: 0.04300 seconds