note 116682 added to internals2.opcodes.instanceof

From: Date: Tue, 10 Feb 2015 18:46:39 +0000
Subject: note 116682 added to internals2.opcodes.instanceof
Groups: php.notes 
Request: Send a blank email to php-notes+get-201693@lists.php.net to get a copy of this message
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 */ } ?> ---- Server IP: 72.52.91.14 Probable Submitter: 50.79.80.225 ---- Manual Page -- http://php.net/manual/en/internals2.opcodes.instanceof.php Edit -- https://master.php.net/note/edit/116682 Del: integrated -- https://master.php.net/note/delete/116682/integrated Del: useless -- https://master.php.net/note/delete/116682/useless Del: bad code -- https://master.php.net/note/delete/116682/bad+code Del: spam -- https://master.php.net/note/delete/116682/spam Del: non-english -- https://master.php.net/note/delete/116682/non-english Del: in docs -- https://master.php.net/note/delete/116682/in+docs Del: other reasons-- https://master.php.net/note/delete/116682 Reject -- https://master.php.net/note/reject/116682 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#201693) next »