note 117491 deleted from internals2.opcodes.instanceof by cmb

From: Date: Sun, 10 Jan 2021 13:21:39 +0000
Subject: note 117491 deleted from internals2.opcodes.instanceof by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-216097@lists.php.net to get a copy of this message
Note Submitter: portugal {at} jawira {dot} com ---- I'm commenting here because the note from "admin at torntech" is incomplete. You can perfectly replace "is_a()" function with "instanceof" operator. However you must use a variable to store the class name, otherwise you will get a Parse error: <?php $object = new \stdClass(); $class_name = '\stdClass'; var_dump($object instanceof $class_name); // bool(true) var_dump($object instanceof '\stdClass'); // Parse error: syntax error, unexpected ''\stdClass'' (T_CONSTANT_ENCAPSED_STRING) ?> Please go to Type Operators page for more details about "instanceof": http://php.net/manual/en/language.operators.type.php

« previous php.notes (#216097) next »