Hi,
What about the following PHP logic:
var_dump(null == 0); // TRUE
var_dump(null < -1); // TRUE
var_dump(null > -1); // FALSE
How can you explain that ?
Greetings
Marc
Am 15.11.2013 00:03, schrieb Yasuo Ohgaki:
> Hi all,
>
> On Tue, Nov 12, 2013 at 4:03 AM, Sanford Whiteman <
> swhitemanlistens-software@cypressintegrated.com> wrote:
>
>>> You don't have to think the current documentation is awful to find ways
>>> of improving it.
>>
>> Sure, go for it!
>
>
> I wrote my misunderstanding to my personal blog. It seems many people
> misunderstand it, just like me :)
>
> Any improvement/correction?
> min() manual page is better to be updated. I'll add min() example blow to
> min() manual
> page also.
>
> Index: operators.xml
> ===================================================================
> --- operators.xml (リビジョン 332115)
> +++ operators.xml (作業コピー)
> @@ -1262,7 +1262,7 @@
> <row>
> <entry><type>bool</type> or
> <type>null</type></entry>
> <entry>anything</entry>
> - <entry>Convert to <type>bool</type>, &false; <
> &true;</entry>
> + <entry>Convert to <type>bool</type> both side, &false; <
> &true;</entry>
> </row>
> <row>
> <entry><type>object</type></entry>
> @@ -1298,8 +1298,28 @@
> </tbody>
> </tgroup>
> </table>
> +
> <para>
> <example>
> + <title>Boolean/null comparison</title>
> + <programlisting role="php">
> +<![CDATA[
> +<?php
> +// Bool and null are compared as bool always
> +var_dump(1 == TRUE); // TRUE - same as (bool)1 == TRUE
> +var_dump(0 == FALSE); // TRUE - same as (bool)0 == FALSE
> +var_dump(100 < TRUE); // FALSE - same as (bool)100 < TRUE
> +var_dump(-10 < FALSE);// FALSE - same as (bool)-10 < FALSE
> +var_dunp(min(-100,-10, NULL, 10, 100); // NULL - (bool)NULL < (bool)-100
> is FALSE < TRUE
> +?>
> +]]>
> + </programlisting>
> + </example>
> + </para>
> +
> +
> + <para>
> + <example>
> <title>Transcription of standard array comparison</title>
> <programlisting role="php">
> <![CDATA[
>