get_class_vars

From: Date: Sun, 12 Sep 2004 04:22:13 +0000
Subject: get_class_vars
Groups: php.general 
Request: Send a blank email to php-general+get-196433@lists.php.net to get a copy of this message
Using the code shown below, I get nothing from get_class_vars but I do get very useful results from get_class_methods. I realize that this is how it is supposed to be, but it would be useful to be able to get the property members of the class. The reason I want to see the properties of DOMDocument is because they are not documented. There are some methods of the DOMDocument class that exist in other implemntations of the DOM but not the PHP 5 implemntation. Probably the equivalent is available using properties to get data instead of methods. Due to the absence of documentation of the properties, it would help to have a function that shows the properties. I will look for the source code and I assume I can find the answer there, so I assume I don't need help with that. Unless there is some other function that will show the properties of a class in the manner I am looking for. <pre><?php function ShowClass($class_name) { print "Class $class_name properties:\n"; $class_vars = get_class_vars($class_name); sort($class_vars); foreach ($class_vars as $name => $value) echo "$name : $value\n"; print "\nClass $class_name methods:\n"; $class_methods = get_class_methods($class_name); sort($class_methods); foreach ($class_methods as $name => $value) echo "$name : $value\n"; } ShowClass("DOMDocument"); ?></pre>

« previous php.general (#196433) next »