Bug #14406: typeof operator

From: Date: Mon, 10 Dec 2001 15:44:05 +0000
Subject: Bug #14406: typeof operator
Groups: php.dev 
Request: Send a blank email to php-dev+get-73091@lists.php.net to get a copy of this message
From: foobardotcom@poczta.onet.pl Operating system: all PHP version: 4.1.0 PHP Bug Type: Feature/Change Request Bug description: typeof operator 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 bug report at: http://bugs.php.net/?id=14406&edit=1

« previous php.dev (#73091) next »