Edit report at https://bugs.php.net/bug.php?id=41072&edit=1

 ID:                 41072
 Updated by:         ni...@php.net
 Reported by:        atomo64 at gmail dot com
 Summary:            Make instanceof work without the need of creating
                     the object first
-Status:             Open
+Status:             Wont fix
 Type:               Feature/Change Request
-Package:            Feature/Change Request
+Package:            *General Issues
 Operating System:   Linux 2.6.18 SMP i686
 PHP Version:        5.2.1
 Block user comment: N
 Private report:     N

 New Comment:

You should be able to check this with the is_subclass_of function.


Previous Comments:
------------------------------------------------------------------------
[2007-04-29 12:07:14] s...@php.net

I'd suggest you use reflection for this:
http://www.php.net/reflection

------------------------------------------------------------------------
[2007-04-13 00:49:11] atomo64 at gmail dot com

Description:
------------
At the moment instanceof requires the first 'parameter' to be an object of the 
class which is to be compared.
It would be useful to be able to check without creating the object.

Reproduce code:
---------------
<?php
class MyClass {}

$class = 'MyClass';

var_dump($class instanceof MyClass);
var_dump($$class instanceof MyClass);
var_dump(MyClass instanceof MyClass);
?>

Expected result:
----------------
bool(false)
bool(true)
bool(true)

Actual result:
--------------
bool(false)
bool(false)
bool(false)


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=41072&edit=1

Reply via email to