note 116856 added to internals2.opcodes.instanceof
| From: | krall dot eugene at gmail dot com | Date: | Tue, 10 Mar 2015 21:54:22 +0000 |
| Subject: | note 116856 added to internals2.opcodes.instanceof | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-201916@lists.php.net to get a copy of this message | ||
When checking instanceof against a class that implements the class in question, it will return true.
<?php
interface ExampleInterface
{
public function interfaceMethod();
}
class ExampleClass implements ExampleInterface
{
public function interfaceMethod()
{
return 'Hello World!';
}
}
$exampleInstance = new ExampleClass();
if($exampleInstance instanceof ExampleInterface)
echo 'Yes, it is';
else
echo 'No, it is not';
?>
The result:
Yes, it is
----
Server IP: 72.52.91.14
Probable Submitter: 195.191.58.30
----
Manual Page -- http://php.net/manual/en/internals2.opcodes.instanceof.php
Edit -- https://master.php.net/note/edit/116856
Del: integrated -- https://master.php.net/note/delete/116856/integrated
Del: useless -- https://master.php.net/note/delete/116856/useless
Del: bad code -- https://master.php.net/note/delete/116856/bad+code
Del: spam -- https://master.php.net/note/delete/116856/spam
Del: non-english -- https://master.php.net/note/delete/116856/non-english
Del: in docs -- https://master.php.net/note/delete/116856/in+docs
Del: other reasons-- https://master.php.net/note/delete/116856
Reject -- https://master.php.net/note/reject/116856
Search -- https://master.php.net/manage/user-notes.php