Re: Re: Beginners query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1 January 2015 at 14:52, Jim Giner <jim.giner@xxxxxxxxxxxxxxxxxx> wrote:

> On 1/1/2015 3:28 AM, Sachin Raut wrote:
>
>> Happy New Year to all members of PHP group.
>>
>> I just want to know the difference between following 3 statements. Or are
>> they all does the same thing.
>>
>> 1. isset($a)
>> 2. !empty($a)
>> 3. $a!=""
>>
>> Thanks
>> Sachin
>>
>>  1 - tells you if a var is defined
>

Incorrect. "Determine if a variable is set and is not NULL."


> 2 - tells you if the var is null or not yet defined.
>

Incorrect. "Determine whether a variable is considered to be empty. A
variable is considered empty if it does not exist or if its value equals
FALSE. empty() does not generate a warning if the variable does not exist."


> 3 - using this as an 'if' condition tells you whether a var is 'not equal'
> to null
>

Incorrect. It literally says "$a not equal to an empty string." There is
nothing about null here. $a will be coerced into a string and then compared
with an empty string.


> BTW - all of this can be found in the manual online.  You should spend the
> time to read some of the introductory items.


Indeed it can (above quotes were lifted directly from the manual). Please
read it before offering seemingly accurate advice. It's great that you want
to contribute to the community, but please make sure the information you
are contributing is accurate.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux