<?php
class Foo {
public $name;
public $type;
public function __construct($name, $type) {
$this->name = $name;
$this->type = $type;
}
}
$array[] = new Foo('first', 0);
$second = new Foo('second', 0);
$array[] = $second;
$array[] = new Foo('third', 1);
$array[] = new Foo('fourth', 1);
PD9waHAKY2xhc3MgRm9vIHsKCXB1YmxpYyAkbmFtZTsKCXB1YmxpYyAkdHlwZTsKCQoJcHVibGljIGZ1bmN0aW9uIF9fY29uc3RydWN0KCRuYW1lLCAkdHlwZSkgewoJCSR0aGlzLT5uYW1lID0gJG5hbWU7CgkJJHRoaXMtPnR5cGUgPSAkdHlwZTsKCX0KfQoKJGFycmF5W10gPSBuZXcgRm9vKCdmaXJzdCcsIDApOwoKJHNlY29uZCA9IG5ldyBGb28oJ3NlY29uZCcsIDApOwokYXJyYXlbXSA9ICRzZWNvbmQ7CiRhcnJheVtdID0gbmV3IEZvbygndGhpcmQnLCAxKTsKJGFycmF5W10gPSBuZXcgRm9vKCdmb3VydGgnLCAxKTsKCiRrZXkgPSBhcnJheV9zZWFyY2goJHNlY29uZCwgJGFycmF5LCB0cnVlKTsKCnByaW50X3IoJGtleSk7Cg==