Re: Return value docs of empty()
| From: | Rowan Collins | Date: | Tue, 09 Jan 2018 13:45:55 +0000 |
| Subject: | Re: Return value docs of empty() | ||
| References: | 1 2 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969386873@lists.php.net to get a copy of this message | ||
On 9 January 2018 13:21:59 GMT+00:00, Peter Cowburn <petercowburn@gmail.com> wrote:
>On 9 January 2018 at 12:55, Christoph M. Becker <cmbecker69@gmx.de>
>wrote:
>
>> Hi!
>>
>> I would suggest to apply the following patch:
>>
>> Index: empty.xml
>> ===================================================================
>> --- empty.xml (revision 343793)
>> +++ empty.xml (working copy)
>> @@ -50,7 +50,7 @@
>> Otherwise returns &true;.
>> </para>
>> <para>
>> - The following things are considered to be empty:
>> + The following values are considered to be empty:
>> <simplelist>
>> <member><literal>""</literal> (an empty
>> string)</member>
>> <member><literal>0</literal> (0 as an integer)</member>
>> @@ -59,7 +59,6 @@
>> <member>&null;</member>
>> <member>&false;</member>
>> <member><literal>array()</literal> (an empty array)</member>
>> - <member><literal>$var;</literal> (a variable declared, but
>without
>> a value)</member>
>> </simplelist>
>> </para>
>> </refsect1>
>>
>> Any objections?
>>
>
>Not from me. The variable-without-a-value is covered by the null case,
>and
>the fact that a variable-without-a-value is null is covered elsewhere.
I don't know if there are other notes on the page that make it redundant, but the handling of
undefined variables is one of the most important things about empty() - as a language construct, it
has a unique ability to accept them without generating a notice.
Regards,
Rowan
--
Rowan Collins
[IMSoP]