Using PHP’s ReflectionClass. Is this possible?
I want to get a list of methods and the defined variables and if possible their default values too.
$reflection = new \ReflectionClass($var);
$methods = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC);
print_r($methods); // only method names here :(
Use the
ReflectionParameter::getDefaultValue()method. With your code example:An example: