Task

The goal is to get the properties of an object, as names, values or both.

Some languages support dynamic properties, which in general can only be inspected if a class' public API includes a way of listing them.

<?
class Foo {
}
$obj = new Foo();
$obj->bar = 42;
$obj->baz = true;
 
var_dump(get_object_vars($obj));
?>