|
Posted by Marcin Dobrucki on 08/08/06 13:47
wildernesscat wrote:
> Hi Jerry,
>
> I'm trying to write a function that checks whether a given object is of
> a known class (named 'A' in this example). I want it to work even if
> the object has been constructed manually, starting from 'new
> StdClass()'.
I think this is VERY different from what you asked in the first mail.
But to do that, you want something like this:
class Foo (
function Foo() {}
}
$f = new Foo();
....
if (is_a($f, 'Foo')) {
echo "yes";
}
....
echo "\$f is of type: " . get_class($f);
To do what you asked before (and hence break some main concepts in
OO), you can:
$vars = get_class_vars('Foo');
/M
Navigation:
[Reply to this message]
|