note 116682 deleted from internals2.opcodes.instanceof by cmb

From: Date: Sun, 10 Jan 2021 13:21:35 +0000
Subject: note 116682 deleted from internals2.opcodes.instanceof by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-216095@lists.php.net to get a copy of this message
Note Submitter: admin at torntech dot com ---- Despite this section being opcode examples, for php 5.3+ see also is_a() *Note php 5.0 - 5.2 is_a() was depreciated in favor of instanceof but was undepreciated in 5.3+. Allows for string comparison against the class name and functions in the same manner as cody mentions like so. <?php namespace Foo{ class Bar {} class Baz extends Bar{} } namespace { $baz = new Foo\Baz; var_dump($baz instanceof Foo\Bar); /* returns bool(true) */ var_dump(is_a($baz, 'Foo\\Bar')); /* returns bool(true) */ var_dump($baz instanceof 'Foo\\Bar'); /* returns Runtime parse error */ } ?>

« previous php.notes (#216095) next »