If you want to retrieve the class vars from within the class itself, use $this.
<?php
class Foo {
var $a;
var $b;
var $c;
var $d;
var $e;
function GetClassVars()
{
return array_keys(get_class_vars(get_class($this))); // $this
}
}
$Foo = new Foo;
$class_vars = $Foo->GetClassVars();
foreach ($class_vars as $cvar)
{
echo $cvar . "<br />\n";
}
?>
Produces, after PHP 4.2.0, the following:
a
b
c
d
e