How can I expose the object's method and properties?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Betty_S
Forum Newbie
Posts: 20
Joined: Tue Dec 05, 2006 3:40 am

How can I expose the object's method and properties?

Post by Betty_S »

Hi everyone

How can I expose the object's method and properties?
Is there a php command or keyword which expose the object's method and properties?
For example: print_r arr[0]; will print on the screen all of the array (the index or keys and the content). I'm look for somting simler that prints on the screen all of the object's method and properties.
So, who can I print all of the object's 'tree' of functions and variables?

Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

If you are using PHP 4, there's nothing. If you are using PHP 5, there's reflection. http://php.net/language.oop5.reflection
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

in php4 you can use get_class_vars and get_object_vars. It's not as powerful as reflection but it might be sufficient.
Post Reply