note 120852 deleted from internals2.opcodes.instanceof by cmb

From: Date: Sun, 10 Jan 2021 13:21:36 +0000
Subject: note 120852 deleted from internals2.opcodes.instanceof by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-216096@lists.php.net to get a copy of this message
Note Submitter: katrinaelaine6 at gmail dot com ---- instanceof also works on abstract classes and interfaces. <?php abstract class Grandpa {} interface Father {} interface Son {} class Base extends Grandpa implements Father {} class Child extends Base implements Son {} $b = new Base(); $c = new Child(); /* All of the following are true. */ var_dump($b instanceof Grandpa); var_dump($b instanceof Father); var_dump($c instanceof Son); var_dump($c instanceof Father); var_dump($c instanceof Grandpa); ?>

« previous php.notes (#216096) next »