mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
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:
parent
a14d8cc169
commit
fe3066e83f
1 changed files with 22 additions and 1 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue