By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,664 Members | 1,643 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,664 IT Pros & Developers. It's quick & easy.

Utility to print to screen class name, vars and functions?

P: n/a
I am thinking of writing a utility that will read a class and output
something like the example below to the screen:-

Class: User
Variable Names: $name, $age, $sex
Function Names: addUser, editUser, approveUser, activateUser, deleteUser

I would like to be able to actually select which classes to process and
perhaps use a stylesheet to format the output. Even might look at adding
other information such as last modified date.

It doesn't look too difficult using "get_class_vars" and "get_class_methods"
but before I go off and do this, I wondered if any such thing already
exists?

Cheers

Phil

Feb 22 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Phil Latio kirjoitti:
I am thinking of writing a utility that will read a class and output
something like the example below to the screen:-

Class: User
Variable Names: $name, $age, $sex
Function Names: addUser, editUser, approveUser, activateUser, deleteUser

I would like to be able to actually select which classes to process and
perhaps use a stylesheet to format the output. Even might look at adding
other information such as last modified date.

It doesn't look too difficult using "get_class_vars" and "get_class_methods"
but before I go off and do this, I wondered if any such thing already
exists?
I'm thinking with var_dump you get the most out of a class variables,
then combine it with get_class_methods and there you have it. A very
nice reflection of the class.

var_dump($object);
echo 'functions: '.implode(',', get_class_methods(get_class($object)));

--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviö
sp**@outolempi.net | Gedoon-S @ IRCnet | rot13(xv***@bhgbyrzcv.arg)
Feb 22 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.