| 
	
 | 
 Posted by Kimmo Laine on 02/22/07 18:40 
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ö 
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)
 
[Back to original message] 
 |