[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-general
Subject:    [PHP] Re: isset empty or ...?
From:       74.70.148.153
Date:       2013-03-31 13:17:00
Message-ID: A2.22.20307.B4738515 () pb1 ! pair ! com
[Download RAW message or body]

On 3/31/2013 12:53 AM, John Taylor-Johnston wrote:
> I'm using
>
> if($mydata->DPRresponselocationaddress1 != "")
>
> is this the same as
>
> if (!isset($mydata->DPRresponselocationaddress))
> http://php.net/manual/en/function.isset.php
>
> or
>
> if (!empty($mydata->DPRresponselocationaddress))
> http://php.net/manual/en/function.empty.php
>
> or is there another function I have not learned yet? I don't really get
> the difference between isset and empty.
>
> John
The simple answer is that isset is supposed to tell you if a var has 
been created; a test for "" is looking for a value of a var.  While 
sometimes the results can be the same (and therefore confusing) that is 
what the two provide.  How you use them is dependent on your 
understanding of PHP and the task before you.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic