1class Foo
2{
3 private $foo;
4 protected $bar;
5 public $baz;
6
7 public function __construct()
8 {
9 $this->foo = 1;
10 $this->bar = 2;
11 $this->baz = new StdClass;
12 }
13}
14
15var_dump( (array) new Foo );
16
1$object = new StdClass;
2$object->foo = 1;
3$object->bar = 2;
4
5var_dump( (array) $object );
6