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 #173836 is a reply to message #173827] Sat, 07 May 2011 17:50 Go to previous messageGo to previous message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma:
Senior Member
On 5/7/2011 7:36 AM, Jerry Stuckle wrote:
> 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().

Exactly, when I use isset it does not error.
Thanks.

bill
[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: Sat Nov 30 09:51:18 GMT 2024

Total time taken to generate the page: 0.06536 seconds