Better fix for #50738

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@293507 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Richard Quadling 2010-01-13 16:12:39 +00:00
parent 817045d08d
commit fec07db19f

View file

@ -1096,19 +1096,21 @@ Expression: 0 = -4 << 62
</tgroup>
</table>
<para>
If you compare an integer with a string, excluding the identical (===) and
not identical (!==) operators, the string is
<link linkend="language.types.string.conversion">converted to a number</link>.
If you compare two numerical strings, they are compared as integers. These
rules also apply to the
<link linkend="control-structures.switch">switch</link> statement.
If you compare a number with a string or the comparison involves numerical
strings,then each string is
<link linkend="language.types.string.conversion">converted to a number</link>
and the comparison performed numerically. These rules also apply to the
<link linkend="control-structures.switch">switch</link> statement. The
type conversion does not take place when the comparison is === or !== as
this involves comparing the type as well as the value.
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
var_dump(0 == "a"); // 0 == 0 -> true
var_dump("1" == "01"); // 1 == 1 -> true
var_dump("1" == "1e0"); // 1 == 1 -> true
var_dump("10" == "1e1"); // 10 == 10 -> true
var_dump(100 == "1e2"); // 100 == 100 -> true
switch ("a") {
case 0: