Reapply accidentially lost part of fix for bug #80003

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@350380 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Christoph Michael Becker 2020-08-25 13:18:01 +00:00
parent a14d8cc169
commit fe3066e83f

View file

@ -2520,7 +2520,8 @@ bool(false)
</para>
<para>
instanceof does not throw any error if the variable being tested is not
an object, it simply returns &false;. Constants, however, are not allowed.
an object, it simply returns &false;. Constants, however, were not allowed
prior to PHP 7.3.0.
<example>
<title>Using <literal>instanceof</literal> to test other variables</title>
<programlisting role="php">
@ -2543,6 +2544,26 @@ bool(false)
bool(false)
bool(false)
PHP Fatal error: instanceof expects an object instance, constant given
]]>
</screen>
</example>
</para>
<para>
As of PHP 7.3.0, constants are allowed on the left-hand-side of the
<literal>instanceof</literal> operator.
<example>
<title>Using <literal>instanceof</literal> to test constants</title>
<programlisting role="php">
<![CDATA[
<?php
var_dump(FALSE instanceof stdClass);
?>
]]>
</programlisting>
&example.outputs.73;
<screen>
<![CDATA[
bool(false)
]]>
</screen>
</example>