#14406 [Opn->Csd]: typeof operator

From: Date: Sat, 18 Jan 2003 19:19:45 +0000
Subject: #14406 [Opn->Csd]: typeof operator
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-30505@lists.php.net to get a copy of this message
ID: 14406 Updated by: andrey@php.net Reported By: foobardotcom@poczta.onet.pl -Status: Open +Status: Closed Bug Type: Feature/Change Request Operating System: all PHP Version: 4.1.0 New Comment: There will be "instanceof" in PHP5. Previous Comments: ------------------------------------------------------------------------ [2001-12-10 10:44:04] foobardotcom@poczta.onet.pl First part of code is the same in every way: class Foo {} $o = new Foo(); Now there is: if (get_class($o) == "foo") { // ok } else { // not ok } I can create walkaround: function typeof(&$obj, $classname) { return (get_class($obj) == strtolower(trim($classname))); } if (typeof($o, "Foo"))) { // ok } else { // not ok } You should make it easier, by new `typeof' operator: if ($o typeof Foo) { // ok } else { // not ok } like in JavaScript. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=14406&edit=1

« previous php.bugs (#30505) next »