If I have an object, how can I know the details of the object. Like the file in which it is defined, its methods, properties etc.
+3
A:
If you want something simpler, there's get_class_methods(), get_object_methods(), get_class_vars(), get_object_vars(), etc.
kijin
2010-10-30 05:47:05
thanks.. i was looking for get_object_methods and get_object_vars.. I couldn't use Reflection classes, since I want the info based on the object i have in hand..
robert
2010-10-30 06:47:35
+4
A:
You can use PHP reflection functionalities
$class = new ReflectionClass('MyClass');
echo $class->getFileName()."\n";
var_dump($class->getMethods());
var_dump($class->getProperties());
Edit:
ReflectionClass is used on classes and ReflectionObject on objects.
Alexandre Jasmin
2010-10-30 05:49:43