Re: Re: Beginners query
| From: | Ashley Sheridan | Date: | Sat, 03 Jan 2015 12:27:59 +0000 |
| Subject: | Re: Re: Beginners query | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324217@lists.php.net to get a copy of this message | ||
On 2 January 2015 21:31:50 GMT+00:00, Wan Chaowei <weiqk@hotmail.com> wrote:
>
>
>
>
>website: http://5go.cc/
>QR Code Generator: http://5go.cc/QRCodeGenerator
>"Jim Giner" 写入消息
>news:D1.99.60454.91F55A45@pb1.pair.com...
>
>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
>2 - tells you if the var is null or not yet defined.
No, empty() determines if a variable is defined and has a value that is not null, an empty string,
the value false, a 0 or "0", or an empty array.
>3 - using this as an 'if' condition tells you whether a var is 'not
>equal' to null
>
>plz more note false, null, 0, and empty string, in this case the are
>same
It checks foremostly that $a is not an empty string, but if $a is not a string the type conversion
in PHP takes place. For strict comparison use !==
>
>BTW - all of this can be found in the manual online. You should spend
>the time to read some of the introductory items.
Thanks,
Ash