instanceof on class (not objects) php 5
| From: | Greg Beaver | Date: | Sun, 06 Jul 2003 05:41:35 +0000 |
| Subject: | instanceof on class (not objects) php 5 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-154108@lists.php.net to get a copy of this message | ||
Hi,
Is it possible to determine whether a class implements an interface without instantiating an object of that class?
<?php
interface tester {
function doesStuff();} class MyClass implements tester {
function doesStuff(){}
}
$var = 'MyClass';
if ($var instanceof_equiv tester) {
...} ?> I really need this kind of capability to determine whether an argument is a valid class for the purposes needed. I guess if reflection makes it into beta 2, I will have what I need, but is there something in beta 1? Thanks, Greg